Quantcast

plot.prcomp() call/eval

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

plot.prcomp() call/eval

Jessica Streicher
Hi!

I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
Til now, creating the calls and plotting later on this way worked fine. Example:

 pcaI<-prcomp(iris[,1:4])
 plot(pcaI)

 x<-call("plot",pcaI)
 eval(x)

Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Joshua Wiley-2
Hi Jessica,

x <- call("plot", quote(pcaI))
eval(x)

that said, I suspect you would be better off avoiding this idiom
altogether.  Storing unevaluated calls is akin to putting tomatoes on
your sandwich before packing it for work---you can do it but you end
up with a soggy sandwich by the time you are eating it.  Better to
store the bread and tomatoe separately and put them together when you
want a delicious sandwich.

Cheers,

Josh

On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
<[hidden email]> wrote:

> Hi!
>
> I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
> Til now, creating the calls and plotting later on this way worked fine. Example:
>
>  pcaI<-prcomp(iris[,1:4])
>  plot(pcaI)
>
>  x<-call("plot",pcaI)
>  eval(x)
>
> Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Jessica Streicher
Thanks Josh,

that soggy sandwhich saves me a LOT of code by the way,
I'll keep it  for the time being  ;)

greetings
Jessica

On 28.06.2012, at 17:15, Joshua Wiley wrote:

> Hi Jessica,
>
> x <- call("plot", quote(pcaI))
> eval(x)
>
> that said, I suspect you would be better off avoiding this idiom
> altogether.  Storing unevaluated calls is akin to putting tomatoes on
> your sandwich before packing it for work---you can do it but you end
> up with a soggy sandwich by the time you are eating it.  Better to
> store the bread and tomatoe separately and put them together when you
> want a delicious sandwich.
>
> Cheers,
>
> Josh
>
> On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
> <[hidden email]> wrote:
>> Hi!
>>
>> I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
>> Til now, creating the calls and plotting later on this way worked fine. Example:
>>
>>  pcaI<-prcomp(iris[,1:4])
>>  plot(pcaI)
>>
>>  x<-call("plot",pcaI)
>>  eval(x)
>>
>> Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Bert Gunter
In reply to this post by Joshua Wiley-2
Yes. One usually creates a call object when one need to modify it  in some
way -- e.g. alter arguments, change the function -- prior to evaluation.
That doesn't seem to be the case here.

Why isn't  plot(pcal) acceptable?

?do.call

is also a more straightforward way to create and evaluate a call in one go.

-- Bert

On Thu, Jun 28, 2012 at 8:15 AM, Joshua Wiley <[hidden email]>wrote:

> Hi Jessica,
>
> x <- call("plot", quote(pcaI))
> eval(x)
>
> that said, I suspect you would be better off avoiding this idiom
> altogether.  Storing unevaluated calls is akin to putting tomatoes on
> your sandwich before packing it for work---you can do it but you end
> up with a soggy sandwich by the time you are eating it.  Better to
> store the bread and tomatoe separately and put them together when you
> want a delicious sandwich.
>
> Cheers,
>
> Josh
>
> On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
> <[hidden email]> wrote:
> > Hi!
> >
> > I am getting a lot of numbers in the background of the pca screeplots if
> i use call("plot") and eval(somecall).
> > Til now, creating the calls and plotting later on this way worked fine.
> Example:
> >
> >  pcaI<-prcomp(iris[,1:4])
> >  plot(pcaI)
> >
> >  x<-call("plot",pcaI)
> >  eval(x)
> >
> > Anyone got an idea how i can avoid that? (also it might take a second or
> so for the numbers to appear, so wait a bit before you tell me everythings
> fine ^^)
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Joshua Wiley-2
In reply to this post by Jessica Streicher
On Thu, Jun 28, 2012 at 8:27 AM, Jessica Streicher
<[hidden email]> wrote:
> Thanks Josh,
>
> that soggy sandwhich saves me a LOT of code by the way,
> I'll keep it  for the time being  ;)

There may be other ways.  With no knowledge of your context, obviously
I cannot say absolutely that there are better ways to save yourself
code, but I can say that there often are.

>
> greetings
> Jessica
>
> On 28.06.2012, at 17:15, Joshua Wiley wrote:
>
>> Hi Jessica,
>>
>> x <- call("plot", quote(pcaI))
>> eval(x)
>>
>> that said, I suspect you would be better off avoiding this idiom
>> altogether.  Storing unevaluated calls is akin to putting tomatoes on
>> your sandwich before packing it for work---you can do it but you end
>> up with a soggy sandwich by the time you are eating it.  Better to
>> store the bread and tomatoe separately and put them together when you
>> want a delicious sandwich.
>>
>> Cheers,
>>
>> Josh
>>
>> On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
>> <[hidden email]> wrote:
>>> Hi!
>>>
>>> I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
>>> Til now, creating the calls and plotting later on this way worked fine. Example:
>>>
>>>  pcaI<-prcomp(iris[,1:4])
>>>  plot(pcaI)
>>>
>>>  x<-call("plot",pcaI)
>>>  eval(x)
>>>
>>> Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>> --
>> Joshua Wiley
>> Ph.D. Student, Health Psychology
>> Programmer Analyst II, Statistical Consulting Group
>> University of California, Los Angeles
>> https://joshuawiley.com/
>



--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Jessica Streicher
Well, i built the methods to create a bit of latex and plot to pdf files for figures, especially figures with subfloats, which weren't possible with sweave (at least i didn't find a way). So i only have to make the calls, give them to the method, and will get proper latex, and the plots will be saved to files.

I'm saving several lines of latex and several lines when creating the file each time i use it, and i use it often.


On 28.06.2012, at 17:47, Joshua Wiley wrote:

> On Thu, Jun 28, 2012 at 8:27 AM, Jessica Streicher
> <[hidden email]> wrote:
>> Thanks Josh,
>>
>> that soggy sandwhich saves me a LOT of code by the way,
>> I'll keep it  for the time being  ;)
>
> There may be other ways.  With no knowledge of your context, obviously
> I cannot say absolutely that there are better ways to save yourself
> code, but I can say that there often are.
>
>>
>> greetings
>> Jessica
>>
>> On 28.06.2012, at 17:15, Joshua Wiley wrote:
>>
>>> Hi Jessica,
>>>
>>> x <- call("plot", quote(pcaI))
>>> eval(x)
>>>
>>> that said, I suspect you would be better off avoiding this idiom
>>> altogether.  Storing unevaluated calls is akin to putting tomatoes on
>>> your sandwich before packing it for work---you can do it but you end
>>> up with a soggy sandwich by the time you are eating it.  Better to
>>> store the bread and tomatoe separately and put them together when you
>>> want a delicious sandwich.
>>>
>>> Cheers,
>>>
>>> Josh
>>>
>>> On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
>>> <[hidden email]> wrote:
>>>> Hi!
>>>>
>>>> I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
>>>> Til now, creating the calls and plotting later on this way worked fine. Example:
>>>>
>>>>  pcaI<-prcomp(iris[,1:4])
>>>>  plot(pcaI)
>>>>
>>>>  x<-call("plot",pcaI)
>>>>  eval(x)
>>>>
>>>> Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
>>>>        [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>>> --
>>> Joshua Wiley
>>> Ph.D. Student, Health Psychology
>>> Programmer Analyst II, Statistical Consulting Group
>>> University of California, Los Angeles
>>> https://joshuawiley.com/
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Jessica Streicher



On 29.06.2012, at 10:05, Jessica Streicher wrote:

> Well, i built the methods to create a bit of latex and plot to pdf files for figures, especially figures with subfloats, which weren't possible with sweave (at least i didn't find a way). So i only have to make the calls, give them to the method, and will get proper latex, and the plots will be saved to files.
>
> I'm saving several lines of latex and several lines when creating the file each time i use it, and i use it often.
>
>
> On 28.06.2012, at 17:47, Joshua Wiley wrote:
>
>> On Thu, Jun 28, 2012 at 8:27 AM, Jessica Streicher
>> <[hidden email]> wrote:
>>> Thanks Josh,
>>>
>>> that soggy sandwhich saves me a LOT of code by the way,
>>> I'll keep it  for the time being  ;)
>>
>> There may be other ways.  With no knowledge of your context, obviously
>> I cannot say absolutely that there are better ways to save yourself
>> code, but I can say that there often are.
>>
>>>
>>> greetings
>>> Jessica
>>>
>>> On 28.06.2012, at 17:15, Joshua Wiley wrote:
>>>
>>>> Hi Jessica,
>>>>
>>>> x <- call("plot", quote(pcaI))
>>>> eval(x)
>>>>
>>>> that said, I suspect you would be better off avoiding this idiom
>>>> altogether.  Storing unevaluated calls is akin to putting tomatoes on
>>>> your sandwich before packing it for work---you can do it but you end
>>>> up with a soggy sandwich by the time you are eating it.  Better to
>>>> store the bread and tomatoe separately and put them together when you
>>>> want a delicious sandwich.
>>>>
>>>> Cheers,
>>>>
>>>> Josh
>>>>
>>>> On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
>>>> <[hidden email]> wrote:
>>>>> Hi!
>>>>>
>>>>> I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
>>>>> Til now, creating the calls and plotting later on this way worked fine. Example:
>>>>>
>>>>> pcaI<-prcomp(iris[,1:4])
>>>>> plot(pcaI)
>>>>>
>>>>> x<-call("plot",pcaI)
>>>>> eval(x)
>>>>>
>>>>> Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
>>>>>       [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>>>
>>>> --
>>>> Joshua Wiley
>>>> Ph.D. Student, Health Psychology
>>>> Programmer Analyst II, Statistical Consulting Group
>>>> University of California, Los Angeles
>>>> https://joshuawiley.com/
>>>
>>
>>
>>
>> --
>> Joshua Wiley
>> Ph.D. Student, Health Psychology
>> Programmer Analyst II, Statistical Consulting Group
>> University of California, Los Angeles
>> https://joshuawiley.com/
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Jessica Streicher
Hm.. i attached a file with the code, but it doesn't show up somehow..

On 29.06.2012, at 10:13, Jessica Streicher wrote:

>
>
> On 29.06.2012, at 10:05, Jessica Streicher wrote:
>
>> Well, i built the methods to create a bit of latex and plot to pdf files for figures, especially figures with subfloats, which weren't possible with sweave (at least i didn't find a way). So i only have to make the calls, give them to the method, and will get proper latex, and the plots will be saved to files.
>>
>> I'm saving several lines of latex and several lines when creating the file each time i use it, and i use it often.
>>
>>
>> On 28.06.2012, at 17:47, Joshua Wiley wrote:
>>
>>> On Thu, Jun 28, 2012 at 8:27 AM, Jessica Streicher
>>> <[hidden email]> wrote:
>>>> Thanks Josh,
>>>>
>>>> that soggy sandwhich saves me a LOT of code by the way,
>>>> I'll keep it  for the time being  ;)
>>>
>>> There may be other ways.  With no knowledge of your context, obviously
>>> I cannot say absolutely that there are better ways to save yourself
>>> code, but I can say that there often are.
>>>
>>>>
>>>> greetings
>>>> Jessica
>>>>
>>>> On 28.06.2012, at 17:15, Joshua Wiley wrote:
>>>>
>>>>> Hi Jessica,
>>>>>
>>>>> x <- call("plot", quote(pcaI))
>>>>> eval(x)
>>>>>
>>>>> that said, I suspect you would be better off avoiding this idiom
>>>>> altogether.  Storing unevaluated calls is akin to putting tomatoes on
>>>>> your sandwich before packing it for work---you can do it but you end
>>>>> up with a soggy sandwich by the time you are eating it.  Better to
>>>>> store the bread and tomatoe separately and put them together when you
>>>>> want a delicious sandwich.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Josh
>>>>>
>>>>> On Thu, Jun 28, 2012 at 8:03 AM, Jessica Streicher
>>>>> <[hidden email]> wrote:
>>>>>> Hi!
>>>>>>
>>>>>> I am getting a lot of numbers in the background of the pca screeplots if i use call("plot") and eval(somecall).
>>>>>> Til now, creating the calls and plotting later on this way worked fine. Example:
>>>>>>
>>>>>> pcaI<-prcomp(iris[,1:4])
>>>>>> plot(pcaI)
>>>>>>
>>>>>> x<-call("plot",pcaI)
>>>>>> eval(x)
>>>>>>
>>>>>> Anyone got an idea how i can avoid that? (also it might take a second or so for the numbers to appear, so wait a bit before you tell me everythings fine ^^)
>>>>>>      [[alternative HTML version deleted]]
>>>>>>
>>>>>> ______________________________________________
>>>>>> [hidden email] mailing list
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Joshua Wiley
>>>>> Ph.D. Student, Health Psychology
>>>>> Programmer Analyst II, Statistical Consulting Group
>>>>> University of California, Los Angeles
>>>>> https://joshuawiley.com/
>>>>
>>>
>>>
>>>
>>> --
>>> Joshua Wiley
>>> Ph.D. Student, Health Psychology
>>> Programmer Analyst II, Statistical Consulting Group
>>> University of California, Los Angeles
>>> https://joshuawiley.com/
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Joshua Wiley-2
On Fri, Jun 29, 2012 at 1:20 AM, Jessica Streicher
<[hidden email]> wrote:
> Hm.. i attached a file with the code, but it doesn't show up somehow..

non text files are scrubbed, and only certain file extensions are
allowed (I forget which, I know that .R is *not* allowed (although I
think that .txt and maybe .log are).

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plot.prcomp() call/eval

Jessica Streicher
Then lets go with this:

http://pastebin.com/6dtGCrpA

as an example of what i do. If you've got a better idea lets hear it :)


On 29.06.2012, at 17:30, Joshua Wiley wrote:

> On Fri, Jun 29, 2012 at 1:20 AM, Jessica Streicher
> <[hidden email]> wrote:
>> Hm.. i attached a file with the code, but it doesn't show up somehow..
>
> non text files are scrubbed, and only certain file extensions are
> allowed (I forget which, I know that .R is *not* allowed (although I
> think that .txt and maybe .log are).

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...