[R] "Safe" way to automatically install required packages...
Jonathan Greenberg
greenberg at ucdavis.edu
Mon Nov 2 19:56:25 CET 2009
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
--
Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307
More information about the R-help
mailing list