[R] plot.prcomp() call/eval

Joshua Wiley jwiley.psych at gmail.com
Thu Jun 28 17:47:41 CEST 2012


On Thu, Jun 28, 2012 at 8:27 AM, Jessica Streicher
<j.streicher at micromata.de> 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
>> <j.streicher at micromata.de> 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]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org 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/



More information about the R-help mailing list