For pete's sake, I knew that. I apologize for wasting everyone's time. I tell ya, this has been an off week for me.
Thank you for your kind responses. On Aug 4, 2011, at 9:35 PM, Rolf Turner wrote: > > Note that ***histogram()*** (as opposed to "hist()") is a function from the > "lattice" package. So at some stage you must have issued the command > "require(lattice)" or equivalently "library(lattice)". (So your ``exact > code'' > is a little misleading.) > > You are thus getting bitten by the fact that the output of lattice > plot functions must be explicitly *printed* when called from within > a function such as source(). See fortune("line 800"). They needn't > be explicitly printed when called from the command line, which is > why you are getting the figure you expect by typing the code at the > R prompt. > > So put > > print(histogram(~Total.Change,data=x,xlab="Percent Change")) > > in the file that you are source()-ing and all will be in harmony in the > universe. > > Nothing really to do either with source() or with OS X Lion. > > cheers, > > Rolf Turner > > P. S. Apropos of nothing (but speaking of lions) everyone should read > ``The Lion of Boaz-Jachin and Jachin-Boaz'' by Russell Hoban. :-) > > R. T. > > On 05/08/11 09:24, Mark Ebbert wrote: >> Dear R Gurus, >> >> I'm seeing some strange behavior that I can't explain. I'm generating a >> figure for a paper and I like to save the script (no matter how simple) for >> future reference. My practice is to write the script and run it using the >> 'source()' function. What's weird is that the resultant figure is not >> readable by OS X 10.7.0 (Lion). While trying to figure out what I did wrong, >> I discovered that typing the exact same code into the R prompt (running in >> Terminal) will produce the figure as I would expect it. The only idea I have >> is that something has changed in Lion that doesn't allow 'source()' to >> interpret it properly. >> >> Any ideas? Here is the exact code I'm using: >> 1 x<-read.delim("path/data.txt") >> 2 >> 3 pdf("path/PaperFig-hist_of_perc_change-individ_samps-by_subtype.pdf") >> 4 histogram(~Total.Change,data=x,xlab="Percent Change") >> 5 dev.off() >> >> I appreciate any help. I'm especially curious if there's a Lion user who >> could give this a try. >> >> OS X 10.7.0 (Lion) >> R version 2.13.0 (2011-04-13) >> Copyright (C) 2011 The R Foundation for Statistical Computing >> ISBN 3-900051-07-0 >> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > ______________________________________________ R-help@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.