0

While using the Boot function from the car package I get the error message

Error in get(".y.boot", envir = .carEnv) : object '.carEnv' not found

I suspect I have inadvertently changed/set something in my OS and have no idea what it might be. Running the code below returns an error on my desktop but runs without error on a laptop running the same OS (Yosemite) as well as a desktop running Windows 7 (all using R-3.1.2). The code that triggers the message is

library(car)
swiss.lm <- lm(Fertility ~ Education, data = swiss)
BC <- Boot(swiss.lm, R = 999, method = "case")      # No Problems
BR <- Boot(swiss.lm, R = 999, method = "residual")  # Problems now
Error in get(".y.boot", envir = .carEnv) : object '.carEnv' not found

I have reinstalled R but the error still appears when running the above code. Any suggestions as to what I have done and how to get the code to run and find the environment would be most appreciated. TIA!

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] car_2.0-24

loaded via a namespace (and not attached):
 [1] boot_1.3-15     grid_3.1.2      lattice_0.20-29 lme4_1.1-7      MASS_7.3-   37     Matrix_1.1-5   
 [7] mgcv_1.8-4      minqa_1.2.4     nlme_3.1-119    nloptr_1.0.4    nnet_7.3-9      parallel_3.1.2 
[13] pbkrtest_0.4-2  quantreg_5.11   Rcpp_0.11.4     SparseM_1.6     splines_3.1.2   tools_3.1.2   
user1884192
  • 251
  • 1
  • 9

2 Answers2

0

Looks like a reproducible bug in a car package. According to package news the changes in latest version (2.0-24) are related to .carEnv handling.

I tried to get around the issue by simply assigning the .carEnv before call to Boot with

.carEnv <- car:::.carEnv

This makes the Boot function execute without errors, but I am not sure of any other effects.

bergant
  • 7,122
  • 1
  • 20
  • 24
  • Thanks for your suggestion. Upon closer inspection, I was using car 2.0-22 on my other two test machines that were not returning an error and not 2.0-24. So, it does seem to be a problem with car. – user1884192 Feb 19 '15 at 12:03
0

The package maintainer emailed me and indicated a bug had been introduced in 2.0-24 and that he would attempt to fix the bug.

user1884192
  • 251
  • 1
  • 9