[R] plot.prcomp() call/eval

Jessica Streicher j.streicher at micromata.de
Fri Jun 29 10:05:58 CEST 2012


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
> <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