Skip to content
Prev 373118 / 398498 Next

effects & lme4: error since original data frame not found WASeffects: error when original data frame is missing

Hi, again,

I have to modify my query since my first (too simple)
example doesn't reflect my actual problem. Second try:

When asking Effect() inside a function to compute an effect
of an lmer-fit which uses a data frame local to the body of
the function, as in the following example (simplifying my
actual application), I get the "Error in is.data.frame(data) :
object 'X' not found":

 > foo <- function() {
+  X <- sleepstudy
+  fm <- lmer(Reaction ~ Days + (Days | Subject), data = X)
+  Effect("Days", fm)
+ }

 > foo()

Error in is.data.frame(data) : object 'X' not found


With lm-objects there is no problem:

 > foo2 <- function() {
+   X <- sleepstudy
+   fm <- lm(Reaction ~ Days, data = X)
+   Effect("Days", fm)
+ }

 > foo2()

....

Any idea how to work around this problem?
Once again, thx in advance!

  Regards  --  Gerrit

PS: > sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

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

other attached packages:
[1] effects_4.0-0   carData_3.0-0   lme4_1.1-14     Matrix_1.2-11 
car_2.1-5
[6] lattice_0.20-35

loaded via a namespace (and not attached):
  [1] Rcpp_0.12.13       MASS_7.3-47        grid_3.4.2 
MatrixModels_0.4-1
  [5] nlme_3.1-131       survey_3.32-1      SparseM_1.77 
minqa_1.2.4
  [9] nloptr_1.0.4       splines_3.4.2      tools_3.4.2 
survival_2.41-3
[13] pbkrtest_0.4-7     yaml_2.1.14        parallel_3.4.2 
compiler_3.4.2
[17] colorspace_1.3-2   mgcv_1.8-22        nnet_7.3-12 
quantreg_5.33

---------------------------------------------------------------------
Dr. Gerrit Eichner                   Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109            http://www.uni-giessen.de/eichner
---------------------------------------------------------------------

Am 17.01.2018 um 10:55 schrieb Gerrit Eichner: