Dear R list, members of my course have encountered the following error message:> slm <- lm(price ~ engsize, autoframe)Error in get(x, envir, mode, inherits) : variable "FUN" was not found [more context is given in the fuller listing below]. Once the error is encountered it seems to persist; for example early in one session:> summary(blin.fit)Call: lm(formula = Response ~ Row + Column, data = binframe) Residuals: Min 1Q Median 3Q Max -1.417e+00 -5.833e-01 -4.025e-16 6.042e-01 1.083e+00 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 10.3333 0.7169 14.415 6.98e-06 *** Rowii 4.7500 0.7169 6.626 0.00057 *** Rowiii -4.7500 0.7169 -6.626 0.00057 *** ColumnII 4.3333 0.8278 5.235 0.00195 ** ColumnIII 2.3333 0.8278 2.819 0.03040 * ColumnIV 1.0000 0.8278 1.208 0.27247 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 1.014 on 6 degrees of freedom Multiple R-Squared: 0.9717, Adjusted R-squared: 0.9482 F-statistic: 41.27 on 5 and 6 degrees of freedom, p-value: 0.0001434 but later on, after the error in creating slm:> summary(blin.fit)Call: lm(formula = Response ~ Row + Column, data = binframe) Residuals: Error in get(x, envir, mode, inherits) : variable "FUN" was not found Finally, here are the commands and output leading up to the first instance of the error: [any help greatly appreciated!]> autoframe <- read.table("z:/321 Folder/Data/auto.dat", header=T) > dim(autoframe)[1] 289 11> summary(autoframe)brand id engsize power weight Min. : 1.00 Min. : 1.0 Min. : 796 Min. : 29.00 Min. : 615 1st Qu.: 7.00 1st Qu.: 73.0 1st Qu.:1468 1st Qu.: 57.00 1st Qu.: 890 Median :16.00 Median :148.0 Median :1949 Median : 77.00 Median :1060 Mean :16.38 Mean :146.7 Mean :2007 Mean : 86.37 Mean :1081 3rd Qu.:23.00 3rd Qu.:220.0 3rd Qu.:2226 3rd Qu.:109.00 3rd Qu.:1250 Max. :37.00 Max. :294.0 Max. :6750 Max. :235.00 Max. :2360 length pricem pricea auto Min. :320.0 Min. : 0 Min. : 0 Min. :0.0000 1st Qu.:403.0 1st Qu.: 19570 1st Qu.: 0 1st Qu.:0.0000 Median :436.0 Median : 26530 Median : 0 Median :0.0000 Mean :429.4 Mean : 39200 Mean : 27840 Mean :0.4291 3rd Qu.:454.0 3rd Qu.: 49500 3rd Qu.: 37700 3rd Qu.:1.0000 Max. :520.0 Max. :290000 Max. :310000 Max. :1.0000 nomanual price Min. :0.0000 Min. : 13990 1st Qu.:0.0000 1st Qu.: 24690 Median :0.0000 Median : 35620 Mean :0.1661 Mean : 54510 3rd Qu.:0.0000 3rd Qu.: 63500 Max. :1.0000 Max. :310000> attach(autoframe) > slm <- lm(price ~ engsize, autoframe)Error in get(x, envir, mode, inherits) : variable "FUN" was not found> summary(slm)Error: Object "slm" not found>Murray Jorgensen -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Murray Jorgensen <maj at waikato.ac.nz> writes:> Dear R list, > > members of my course have encountered the following error message: > > > slm <- lm(price ~ engsize, autoframe) > Error in get(x, envir, mode, inherits) : variable "FUN" was not found > [more context is given in the fuller listing below]. >...> > autoframe <- read.table("z:/321 Folder/Data/auto.dat", header=T)Windows, eh? Which version of R? It might be a memory corruption bug of some sort, but without the actual dataset it will be difficult to reproduce. Does the same thing happen with the built-in data sets (e.g. airquality), like data(airquality) dim(airquality) summary(airquality) attach(airquality) slm<-lm(Ozone~Temp,airquality) which would seem to be equivalent to your example (and doesn't crash for me). Is your example the *entire* set of statements leading to the error condition or might there be strange things going on earlier on? Accidentally redefining a function may lead also to this kind of effect. One useful thing would be to issue a traceback() when the error occurs, which should tell you which function the error occurred in. Then one might set a debug() on the function and single step. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 10:22 AM 8/24/99 +0200, Peter Dalgaard BSA wrote:> >Windows, eh? Which version of R? >Initially 0.64.1, but reproduced with 0.64.2.>It might be a memory corruption bug of some sort, but without the >actual dataset it will be difficult to reproduce. > >Does the same thing happen with the built-in data sets (e.g. >airquality), like > >data(airquality) >dim(airquality) >summary(airquality) >attach(airquality) >slm<-lm(Ozone~Temp,airquality) > >which would seem to be equivalent to your example (and doesn't crash >for me). >I will attempt to reproduce the fault using built-in data; failing that I will email you the data [I don't suppose broadcasting a non-tiny dataset to the whole list is very good form!].>Is your example the *entire* set of statements leading to the error >condition or might there be strange things going on earlier on? >Accidentally redefining a function may lead also to this kind of >effect.No, but earlier statements seemed innocuous. I will seek a minimal set of statements generating the error.>One useful thing would be to issue a traceback() when the error >occurs, which should tell you which function the error occurred in. >Then one might set a debug() on the function and single step.I'll try that.> O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 >~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907Murray Jorgensen [no .sig yet on this new PC.] -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I have reproduced the error with a smaller set of commands and a smaller data file on two PCs under both 0.64.1 and 0.64.2. I have not reproduced it with an inbuilt data set (except where it has previously occured with my problem data.)> autoframe <- read.table("f:/maj/R&Splus/auto2.txt", header=T) > attach(autoframe) > slm <- lm(price ~ engsize, autoframe)Error in get(x, envir, mode, inherits) : variable "FUN" was not found> traceback()[1] "get(as.character(f), mode = \"function\")" [2] "match.fun(FUN)" [3] "lapply(answer, length)" [4] "unlist(lapply(answer, length))" [5] "unique(unlist(lapply(answer, length)))" [6] "sapply(xlev, is.null)" [7] "lm(price ~ engsize, autoframe)"> data(airquality) > attach(airquality) > slm<-lm(Ozone~Temp,airquality)Error in get(x, envir, mode, inherits) : variable "FUN" was not found I venture to include the dataset auto2.dat as it is not overly large: brand id engsize power weight length pricem pricea auto nomanual price 1 1 1490 77 910 402 35750 0 0 0 35750 1 2 1712 87 910 402 39850 0 0 0 39850 1 3 1490 77 915 402 40350 0 0 0 40350 1 4 1779 88 1060 433 46850 0 0 0 46850 1 5 2492 115 1160 433 59250 0 0 0 59250 2 6 1781 66 1020 439 50590 52390 1 0 50590 2 7 1781 82 1050 439 56620 0 0 0 56620 2 8 1781 82 1140 439 79730 0 0 0 79730 2 9 1994 85 1060 446 62200 0 0 0 62200 2 10 2226 100 1200 446 79990 0 0 0 79990 2 11 2226 100 1060 442 69500 0 0 0 69500 2 12 2226 100 1200 442 87610 0 0 0 87610 2 13 1994 85 1250 479 71200 0 0 0 71200 2 14 2226 101 1250 479 0 89810 1 1 89810 2 15 2226 101 1330 479 107800 0 0 0 107800 2 16 2226 101 1290 479 0 101410 1 1 101410 2 17 2226 101 1370 479 115700 0 0 0 115700 2 18 2144 134 1300 481 0 130920 1 1 130920 2 19 2144 134 1410 481 144800 0 0 0 144800 2 20 2144 134 1450 481 154810 0 0 0 154810 2 21 2144 147 1300 440 160200 0 0 0 160200 3 22 1766 77 1010 432 49449 55402 1 0 49449 3 23 1766 77 1010 432 54690 58668 1 0 54690 3 24 1990 95 1080 433 60725 64925 1 0 60725 3 25 1990 95 1080 433 63821 67944 1 0 63821 Thanks to Peter Dalgaard and Brian Ripley for their suggestions so far. Murray Jorgensen -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._