Re: [R] save and load user modifications of options
Thanks David! I got a solution, though maybe not optimal. In the zzz.r file of the R package, I include the folloing code: .onLoad <- function(libname,pkgname) { myoptions <- list(ngs.python="sage -python",ngs.macs="macs14") if(exists("myoptions",.GlobalEnv)) options(.GlobalEnv$myoptions) else options(myoptions) } If user save his options in the myoptions list, by loading saved image he does not need to set the option again. However, I still believe there is a more elegant way to let user save his options. Hope someone could come up with a better solution :-) Thanks! Xue On Sat, May 7, 2011 at 5:47 AM, David Winsemius wrote: > > On May 6, 2011, at 8:59 PM, xwang14 wrote: > > Hi, >> >> Could anyone help me with the following problem? After I finished a R >> session and modified some options (for example, set >> options(editor="neditor")), I want save these modifications so that after >> I >> load the saved R data I do not need to modify these options again. What is >> the best way to do this? Is there a way without using an external file? I >> tried save.image. However, only default setting is perserved. >> > > You need to read about your options about setting options at startup. You > can find information in the Installation Manual or by typing: ?Startup > > (I cannot think of a manner in which this can be tied to a data file being > loaded.) > > -- > > David Winsemius, MD > West Hartford, CT > > [[alternative HTML version deleted]] __ 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.
Re: [R] save and load user modifications of options
On May 6, 2011, at 8:59 PM, xwang14 wrote: Hi, Could anyone help me with the following problem? After I finished a R session and modified some options (for example, set options(editor="neditor")), I want save these modifications so that after I load the saved R data I do not need to modify these options again. What is the best way to do this? Is there a way without using an external file? I tried save.image. However, only default setting is perserved. You need to read about your options about setting options at startup. You can find information in the Installation Manual or by typing: ? Startup (I cannot think of a manner in which this can be tied to a data file being loaded.) -- David Winsemius, MD West Hartford, CT __ 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.
[R] save and load user modifications of options
Hi, Could anyone help me with the following problem? After I finished a R session and modified some options (for example, set options(editor="neditor")), I want save these modifications so that after I load the saved R data I do not need to modify these options again. What is the best way to do this? Is there a way without using an external file? I tried save.image. However, only default setting is perserved. Thanks for your help! Xue -- View this message in context: http://r.789695.n4.nabble.com/save-and-load-user-modifications-of-options-tp3504665p3504665.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ 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.