[R] what 's meaning of setting options() through .onLoad() funtion in making a package?
PO SU
rhelpmaillist at 163.com
Fri Aug 29 10:44:29 CEST 2014
Dear expeRts,
I am now reading a book which teaching how to make a r package, i investigated from ?options but nothing said about in making a package. The help document only just introduce some option keys to me in some basic r packages.
But i want to know, why need to set some options in make a r package, e.g.
If i use options(a=3) in my package, what's usage of a ?
The following code is from Hadley wickham's book , i attach it for your better understanding my quesion:
.onLoad <- function(libname, pkgname) {
op <- options()
op.devtools <- list(
devtools.path = "~/R-dev",
devtools.install.args = "",
devtools.name = "Your name goes here",
devtools.desc.author = '"First Last <first.last at example.com> [aut, cre]"',
devtools.desc.license = "What license is it under?",
devtools.desc.suggests = NULL,
devtools.desc = list()
)
toset <- !(names(op.devtools) %in% names(op))
if(any(toset)) options(op.devtools[toset])
invisible()
}
--
PO SU
mail: desolator88 at 163.com
Majored in Statistics from SJTU
More information about the R-help
mailing list