On Mon, Nov 2, 2009 at 10:56 AM, Jonathan Greenberg <greenb...@ucdavis.edu> wrote: > R-helpers: > > I'm working on an r-package that I want to make as easy-to-use as possible > for a novice R-user, which includes automatically installing required > packages. I, myself, am a novice R-packager, so the solution I came up > with was to embed: > > print("Loading required packages...") > if (!require("reshape")) { install.packages("reshape") } > if (!require("reshape")) { > print("Could not install package 'reshape', please contact your > sysadmin.") > return() > } > > in the code proper, and put together the package using package.skeleton() > and R CMD build. > > I'm guessing there's a better way to do this -- any suggestions? > --j
Place the dependencies of your package in a comma-seperated list in the depends: field of the DESCRIPTION file. When a user runs install.packages( 'yourPackage', dependencies = T ), R will take care of downloading and installing the dependencies -Charlie ______________________________________________ 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.