Hello R, To analyze multi-level data, I started learning and using lmer. So far so wonderful. I then found some useful functions in package languageR. But then the following problem ocurred: Whenever I load and use the languageR package, then save the workspace - or quit R with saving the workspace - I am unable to reload that workspace in a later session. That is, R doesn't start at all when I try to start it by clicking the workspace file. Loading languageR before loading the workspace doesn't help, but yields the message: Error in load("D:\\statistics\\MultilevelAnalysis\\.RData") : could not find function "findPackageEnv" Thus, the saved workspace remains inaccessible. I not 100% certain that languageR is the scapegoat, but my trial-and-error experiments indicate it is. My system is Win XP Home/Professional: > sessionInfo() R version 2.5.0 Patched (2007-04-24 r41305) i386-pc-mingw32 locale: LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 attached base packages: [1] "splines" "stats" "graphics" "grDevices" "utils" [6] "datasets" "methods" "base" other attached packages: languageR rpart MASS Design survival "0.2" "3.1-36" "7.2-34" "2.0-12" "2.31" Hmisc e1071 class cluster zipfR "3.3-2" "1.5-16" "7.2-34" "1.11.7" "0.6-0" lme4 coda Matrix lattice "0.99875-1" "0.11-2" "0.99875-2" "0.15-8" thanks for any helpful suggestions! best R?diger -- Hans-R?diger Pfister Professor of Business Psychology University of L?neburg Faculty for Business Administration, Behavioral Sciences and Law Institute of Experimental Industrial Psychology (LueneLab) Wilschenbrucher Weg 84 D-21335 L?neburg, Germany +49-(0)4131 677 7759 pfister at uni-lueneburg.de
Prof Brian Ripley
2007-Jun-15 14:34 UTC
[R] Problem with workspace loading after languageR use
The problem would appear to be something missing in R. From what I can see you have saved a reference to a package environment in your workspace. When load() tries to resolve this, it calls findPackageEnv and that does not exist in current R (or any recent version I looked at). I think adding the following to your new session before load() will help findPackageEnv <- function(info) as.environment(paste("package", "info", sep=":")) will work, but if not try findPackageEnv <- function(info) .GlobalEnv If you send me the problematic workspace (or reproduction instructions) I can take a closer look. On Fri, 15 Jun 2007, Pfister wrote:> Hello R, > > To analyze multi-level data, I started learning and using lmer. So far > so wonderful. I then found some useful functions in package languageR. > But then the following problem ocurred: Whenever I load and use the > languageR package, then save the workspace - or quit R with saving the > workspace - I am unable to reload that workspace in a later session. > That is, R doesn't start at all when I try to start it by clicking the > workspace file. > Loading languageR before loading the workspace doesn't help, but yields > the message: > > Error in load("D:\\statistics\\MultilevelAnalysis\\.RData") : > could not find function "findPackageEnv" > > Thus, the saved workspace remains inaccessible. I not 100% certain that > languageR is the scapegoat, but my trial-and-error experiments indicate > it is. > > My system is Win XP Home/Professional: > > > sessionInfo() > R version 2.5.0 Patched (2007-04-24 r41305) > i386-pc-mingw32 > locale: > LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 > attached base packages: > [1] "splines" "stats" "graphics" "grDevices" "utils" > [6] "datasets" "methods" "base" > other attached packages: > languageR rpart MASS Design survival > "0.2" "3.1-36" "7.2-34" "2.0-12" "2.31" > Hmisc e1071 class cluster zipfR > "3.3-2" "1.5-16" "7.2-34" "1.11.7" "0.6-0" > lme4 coda Matrix lattice > "0.99875-1" "0.11-2" "0.99875-2" "0.15-8" > > > thanks for any helpful suggestions! > > best > R?diger > > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Dear Brian, thanks a lot for your advice. Prof Brian Ripley wrote:> On Fri, 15 Jun 2007, Prof Brian Ripley wrote: > >> >> I think adding the following to your new session before load() will help >> >> findPackageEnv <- function(info) >> as.environment(paste("package", "info", sep=":"))this does not work.> > more likely > > findPackageEnv <- function(info) as.environment(info)this works, if I load the languageR library before.> > is correct. >> >> will work, but if not try >> >> findPackageEnv <- function(info) .GlobalEnvthis works unconditionally. Including that line in a local .RProfile file, basically solves the problem.>> >> If you send me the problematic workspace (or reproduction >> instructions) I can take a closer look.A typical session would look like this (using example data from Hox(2002)): # from Hox (2002) hoxpop <- read.table("http://www.ruediger-pfister.de/download/popular.dat", header=TRUE) hoxpop$PUPIL <- factor(hoxpop$PUPIL) hoxpop$SCHOOL <- factor(hoxpop$SCHOOL) hoxpop$SEX <- factor(hoxpop$SEX) # load languageR library(languageR) # do some analyses ... # save the workspace save.image("D:\\statistics\\MultilevelAnalysis\\lm.RData") After quitting R, the workspace "lm.RData" will not reload. (this workspace can be downloaded here: http://www.ruediger-pfister.de/Downloads/lmRData.zip) best R?diger>> >> >> On Fri, 15 Jun 2007, Pfister wrote: >> >>> Hello R, >>> >>> To analyze multi-level data, I started learning and using lmer. So far >>> so wonderful. I then found some useful functions in package languageR. >>> But then the following problem ocurred: Whenever I load and use the >>> languageR package, then save the workspace - or quit R with saving the >>> workspace - I am unable to reload that workspace in a later session. >>> That is, R doesn't start at all when I try to start it by clicking the >>> workspace file. >>> Loading languageR before loading the workspace doesn't help, but yields >>> the message: >>> >>> Error in load("D:\\statistics\\MultilevelAnalysis\\.RData") : >>> could not find function "findPackageEnv" >>> >>> Thus, the saved workspace remains inaccessible. I not 100% certain that >>> languageR is the scapegoat, but my trial-and-error experiments indicate >>> it is. >>> >>> My system is Win XP Home/Professional: >>> >>> > sessionInfo() >>> R version 2.5.0 Patched (2007-04-24 r41305) >>> i386-pc-mingw32 >>> locale: >>> LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 >>> >>> attached base packages: >>> [1] "splines" "stats" "graphics" "grDevices" "utils" >>> [6] "datasets" "methods" "base" >>> other attached packages: >>> languageR rpart MASS Design survival >>> "0.2" "3.1-36" "7.2-34" "2.0-12" "2.31" >>> Hmisc e1071 class cluster zipfR >>> "3.3-2" "1.5-16" "7.2-34" "1.11.7" "0.6-0" >>> lme4 coda Matrix lattice >>> "0.99875-1" "0.11-2" "0.99875-2" "0.15-8" >>> >>> >>> thanks for any helpful suggestions! >>> >>> best >>> R?diger >>> >>> >>> >> >> >-- Hans-R?diger Pfister Professor of Business Psychology University of L?neburg Faculty for Business Administration, Behavioral Sciences and Law Institute of Experimental Industrial Psychology (LueneLab) Wilschenbrucher Weg 84 D-21335 L?neburg, Germany +49-(0)4131 677 7759 pfister at uni-lueneburg.de