Gregor Gorjanc
2006-Sep-13 08:56 UTC
[Rd] Error: package/namespace load failed for 'fortunes'
Hello! I have the following R code in my .Rprofile file - just for fun. library(fortunes) fortune() detach("package:fortunes") This works nicely in R 2.3.1, but it throws the following error under latest R-devel: ... ... Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. Error in rbind(rval, read.table(file, header = TRUE, sep = ";", quote "\"", : could not find function "read.table" Error: .onLoad failed in 'loadNamespace' for 'fortunes' Error: package/namespace load failed for 'fortunes'>If I start R-devel with empty .Rprofile I am able to issue above R code without problems. Is this caused by move of read.table() to utils package? -- Lep pozdrav / With regards, Gregor Gorjanc ---------------------------------------------------------------------- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc <at> bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europe fax: +386 (0)1 72 17 888 ---------------------------------------------------------------------- "One must learn by doing the thing; for though you think you know it, you have no certainty until you try." Sophocles ~ 450 B.C.
Jeffrey Horner
2006-Sep-13 15:31 UTC
[Rd] Error: package/namespace load failed for 'fortunes'
Gregor Gorjanc wrote:> Hello! > > I have the following R code in my .Rprofile file - just for fun. > > library(fortunes) > fortune() > detach("package:fortunes") > > This works nicely in R 2.3.1, but it throws the following error under > latest R-devel: > > ... > ... > Type 'demo()' for some demos, 'help()' for on-line help, or > 'help.start()' for an HTML browser interface to help. > Type 'q()' to quit R. > > Error in rbind(rval, read.table(file, header = TRUE, sep = ";", quote > "\"", : > could not find function "read.table" > Error: .onLoad failed in 'loadNamespace' for 'fortunes' > Error: package/namespace load failed for 'fortunes' > > If I start R-devel with empty .Rprofile I am able to issue above R code > without problems. Is this caused by move of read.table() to utils package?Your intuition was right. Just add library(utils) before library(fortunes), and it works. Your .Rprofile is executed before .First.sys() (which loads default packages) in base package. ?Startup explains it all. This raises an interesting topic for me: In R-2.3.1, .First.sys() autloads() a few functions from the various default packages (utils, stats, methods, graphics) IF those packages weren't specified in the default packages option (or the environment variable R_DEFAULT_PACKAGES). For instance, if a user doesn't want the utils package automatically loaded, then .First.sys() does this: sch <- search() if(! "package:utils" %in% sch) { autoload("example", "utils") autoload("methods", "utils") autoload("str", "utils") } which will automagically load utils if a call to example, methods, or str is made (why just those three? why not others in utils). I presume there was some heuristic to determine exactly which functions were autoloaded. Now in R-trunk today, I see that there are no autloaded functions set up from .First.sys() for any of the default packages. So if R is started with R_DEFAULT_PACKAGES=NULL, then no default packages will be loaded and no functions will be set up via autoload(). Why? Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner
Maybe Matching Threads
- [Fwd: Re: levels for list and data.frame]
- Fwd: Extract just some fields from XML]
- Re: [Rd] corrupt data frame: columns will be truncated or padded with NAs in: format.data.frame(x, digits = digits)
- Re: Cross-building R packages
- Programming/scripting with "expressions - variables"