[R] Using the Rprofile file to automatically plot data on Startup of R version 2.0.1.

Gabor Grothendieck ggrothendieck at myway.com
Thu Jan 6 05:59:25 CET 2005


I think you could just use the command:  R CMD BATCH myplot.R
with no .First at all.  myplot.R would hold:

win.metafile(filename = "a.wmf", width = 5.7, height = 8.8, pointsize=12)
plot(1:10)
dev.off()

You may want a different output file format so replace the
win.metafile command with whatever you want, 
e.g. bitmap, postscript, etc.   



John Fisler <john.fisler <at> latticesemi.com> writes:

: 
: Berton,
: 
: Thank you for your response.  Loading the graphics library in the .First 
: function worked.
: 
: John
: 
: Berton Gunter wrote:
: > See ?Startup and the rw FAQ for info on startup procedures. I assume by
: > "Rprofile file" you mean Rprofile.site. As ?options --> defaultPackages
: > states, the graphics library is one of those loaded by default but, as
: > ?Startup states,  **not** until after Rprofile.site is executed. Since
: > plot()is now in the graphics library and not in base, it is not present 
when
: > you try to execute your plot commands -- ergo the error. So explicitly load
: > the library by calling library(graphics) ** before ** you plot, and you
: > should then be able to do your plotting.
: > 
: > 
: > -- Bert Gunter
: > Genentech Non-Clinical Statistics
: > South San Francisco, CA
: >  
: > 
: > 
: > 
: >>-----Original Message-----
: >>From: r-help-bounces <at> stat.math.ethz.ch 
: >>[mailto:r-help-bounces <at> stat.math.ethz.ch] On Behalf Of John Fisler
: >>Sent: Wednesday, January 05, 2005 2:51 PM
: >>To: r-help <at> lists.R-project.org; John Fisler
: >>Subject: [R] Using the Rprofile file to automatically plot 
: >>data on Startup of R version 2.0.1.
: >>
: >>Dear R Help Members,
: >>
: >>I have some R functions that plot semiconductor data.  I 
: >>would like to 
: >>automate these plots for individuals in our group such that 
: >>they don't 
: >>have to know R.  I have read the R help manuals and postings but have 
: >>not found this problem.
: >>
: >>I am using R version 2.0.1 under a Windows 2000 operating system.
: >>
: >>The following is a simplified version of what I am tring to do:
: >>
: >>If I insert the following R code in the Rprofile file located in 
: >>directory 'C:\Program Files\R\rw2001\etc':
: >>
: >>x <- c(1,2,3,4,5)
: >>y <- c(2,5,6,3,10)
: >>plot(x,y)
: >>
: >>Using the Rgui.exe or the R.exe terminal version of R the following 
: >>message appears:
: >>
: >>Error: couldn't find function "plot"
: >>
: >>If I copy and paste the command 'plot(x,y)' into the R Console Window 
: >>the scatter plot appears in the R Graphics Device window as expected.
: >>
: >>I have also tried putting the above code in a 'R' script file 
: >>and using 
: >>the source command but I get the same error message.
: >>
: >>Any help would be appreciated.
: >>
: >>Thank you.
: >>
: >>John Fisler
: >>
: >>______________________________________________
: >>R-help <at> stat.math.ethz.ch mailing list
: >>https://stat.ethz.ch/mailman/listinfo/r-help
: >>PLEASE do read the posting guide! 
: >>http://www.R-project.org/posting-guide.html
: >>
: > 
: > 
: >
: 
: ______________________________________________
: R-help <at> stat.math.ethz.ch mailing list
: https://stat.ethz.ch/mailman/listinfo/r-help
: PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
: 
:




More information about the R-help mailing list