Running examples in ‘doBy-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: ls-means
> ### Title: Compute LS-means (aka population means or marginal means)
> ### Aliases: ls-means LSmeans LSmeans.default LSmeans.lmerMod popMeans
> ###   popMeans.default popMeans.lmerMod
> ### Keywords: utilities
> 
> ### ** Examples
> 
> 
> ## Two way anova:
> 
> data(warpbreaks)
> 
> m0 <- lm(breaks ~ wool + tension, data=warpbreaks)
> m1 <- lm(breaks ~ wool * tension, data=warpbreaks)
> LSmeans(m0)
     estimate std.error statistic      df p.value
[1,]  28.1481    1.5809   17.8052 50.0000       0
> LSmeans(m1)
     estimate std.error statistic      df p.value
[1,]  28.1481    1.4888   18.9068 48.0000       0
> 
> ## same as:
> K <- LE_matrix(m0);K
     (Intercept) woolB  tensionM  tensionH
[1,]           1   0.5 0.3333333 0.3333333
> linest(m0, K)
     estimate std.error statistic      df p.value
[1,]  28.1481    1.5809   17.8052 50.0000       0
> K <- LE_matrix(m1);K
     (Intercept) woolB  tensionM  tensionH woolB:tensionM woolB:tensionH
[1,]           1   0.5 0.3333333 0.3333333      0.1666667      0.1666667
> linest(m1, K)
     estimate std.error statistic      df p.value
[1,]  28.1481    1.4888   18.9068 48.0000       0
> 
> LE_matrix(m0, effect="wool")
     (Intercept) woolB  tensionM  tensionH
[1,]           1     0 0.3333333 0.3333333
[2,]           1     1 0.3333333 0.3333333
> LSmeans(m0, effect="wool")
     estimate std.error statistic      df p.value
[1,]  31.0370    2.2357   13.8824 50.0000       0
[2,]  25.2593    2.2357   11.2981 50.0000       0
> 
> LE_matrix(m1, effect="wool")
     (Intercept) woolB  tensionM  tensionH woolB:tensionM woolB:tensionH
[1,]           1     0 0.3333333 0.3333333      0.0000000      0.0000000
[2,]           1     1 0.3333333 0.3333333      0.3333333      0.3333333
> LSmeans(m1, effect="wool")
     estimate std.error statistic      df p.value
[1,]  31.0370    2.1055   14.7412 48.0000       0
[2,]  25.2593    2.1055   11.9970 48.0000       0
> 
> LE_matrix(m0, effect=c("wool", "tension"))
     (Intercept) woolB tensionM tensionH
[1,]           1     0        0        0
[2,]           1     1        0        0
[3,]           1     0        1        0
[4,]           1     1        1        0
[5,]           1     0        0        1
[6,]           1     1        0        1
> LSmeans(m0, effect=c("wool", "tension"))
     estimate std.error statistic      df p.value
[1,]  39.2778    3.1618   12.4227 50.0000       0
[2,]  33.5000    3.1618   10.5953 50.0000       0
[3,]  29.2778    3.1618    9.2599 50.0000       0
[4,]  23.5000    3.1618    7.4325 50.0000       0
[5,]  24.5556    3.1618    7.7664 50.0000       0
[6,]  18.7778    3.1618    5.9390 50.0000       0
> 
> LE_matrix(m1, effect=c("wool", "tension"))
     (Intercept) woolB tensionM tensionH woolB:tensionM woolB:tensionH
[1,]           1     0        0        0              0              0
[2,]           1     1        0        0              0              0
[3,]           1     0        1        0              0              0
[4,]           1     1        1        0              1              0
[5,]           1     0        0        1              0              0
[6,]           1     1        0        1              0              1
> LSmeans(m1, effect=c("wool", "tension"))
     estimate std.error statistic      df p.value
[1,]  44.5556    3.6468   12.2178 48.0000       0
[2,]  28.2222    3.6468    7.7390 48.0000       0
[3,]  24.0000    3.6468    6.5812 48.0000       0
[4,]  28.7778    3.6468    7.8913 48.0000       0
[5,]  24.5556    3.6468    6.7335 48.0000       0
[6,]  18.7778    3.6468    5.1492 48.0000       0
> 
> 
> ## Regression; two parallel regression lines:
> 
> data(Puromycin)
> 
> m0 <- lm(rate ~ state + log(conc), data=Puromycin)
> ## Can not use LSmeans / LE_matrix here because of
> ## the log-transformation. Instead we must do:
> Puromycin$lconc <- log( Puromycin$conc )
> m1 <- lm(rate ~ state + lconc, data=Puromycin)
> 
> LE_matrix(m1)
     (Intercept) stateuntreated     lconc
[1,]           1            0.5 -1.905247
> LSmeans(m1)
     estimate std.error statistic       df p.value
[1,] 126.2787    2.3738   53.1965  20.0000       0
> 
> LE_matrix(m1, effect="state")
     (Intercept) stateuntreated     lconc
[1,]           1              0 -1.905247
[2,]           1              1 -1.905247
> LSmeans(m1, effect="state")
     estimate std.error statistic       df p.value
[1,] 138.8689    3.2868   42.2509  20.0000       0
[2,] 113.6884    3.4332   33.1140  20.0000       0
> 
> LE_matrix(m1, effect="state", at=list(lconc=3))
     (Intercept) stateuntreated lconc
[1,]           1              0     3
[2,]           1              1     3
> LSmeans(m1, effect="state", at=list(lconc=3))
     estimate std.error statistic       df p.value
[1,] 298.6019    9.3499   31.9363  20.0000       0
[2,] 273.4214    9.6975   28.1950  20.0000       0
> 
> ## Non estimable contrasts
> 
> ## ## Make balanced dataset
> dat.bal <- expand.grid(list(AA=factor(1:2), BB=factor(1:3),
+                             CC=factor(1:3)))
> dat.bal$y <- rnorm(nrow(dat.bal))
> 
> ## ## Make unbalanced dataset
> #      'BB' is nested within 'CC' so BB=1 is only found when CC=1
> #       and BB=2,3 are found in each CC=2,3,4
> dat.nst <- dat.bal
> dat.nst$CC <-factor(c(1, 1, 2, 2, 2, 2, 1, 1, 3, 3,
+                       3, 3, 1, 1, 4, 4, 4, 4))
> 
> mod.bal  <- lm(y ~ AA + BB * CC,    data=dat.bal)
> mod.nst  <- lm(y ~ AA + BB : CC, data=dat.nst)
> 
> LSmeans(mod.bal, effect=c("BB", "CC"))
      estimate std.error statistic       df p.value
 [1,] -0.22141   0.67494  -0.32804  8.00000  0.7513
 [2,]  0.37983   0.67494   0.56276  8.00000  0.5890
 [3,] -0.24548   0.67494  -0.36371  8.00000  0.7255
 [4,]  0.61288   0.67494   0.90805  8.00000  0.3904
 [5,]  0.13520   0.67494   0.20031  8.00000  0.8462
 [6,]  0.95081   0.67494   1.40874  8.00000  0.1966
 [7,] -1.41797   0.67494  -2.10090  8.00000  0.0688
 [8,]  0.54000   0.67494   0.80007  8.00000  0.4468
 [9,]  0.46382   0.67494   0.68721  8.00000  0.5114
> LSmeans(mod.nst, effect=c("BB", "CC"))
      estimate std.error statistic       df p.value
 [1,] -0.34217   0.43697  -0.78304 10.00000  0.4518
 [2,]       NA        NA        NA       NA      NA
 [3,]       NA        NA        NA       NA      NA
 [4,]       NA        NA        NA       NA      NA
 [5,]  0.37983   0.75686   0.50185 10.00000  0.6266
 [6,] -0.24548   0.75686  -0.32434 10.00000  0.7524
 [7,]       NA        NA        NA       NA      NA
 [8,]  0.13520   0.75686   0.17863 10.00000  0.8618
 [9,]  0.95081   0.75686   1.25626 10.00000  0.2376
[10,]       NA        NA        NA       NA      NA
[11,]  0.54000   0.75686   0.71347 10.00000  0.4919
[12,]       NA        NA        NA       NA      NA
> LSmeans(mod.nst, at=list(BB=1, CC=1))
     estimate std.error statistic       df p.value
[1,] -0.34217   0.43697  -0.78304 10.00000  0.4518
> 
> LSmeans(mod.nst, at=list(BB=1, CC=2))
     estimate std.error statistic df p.value
[1,]       NA        NA        NA NA      NA
> ## Above: NA's are correct; not an estimable function
> 
> if( require( lme4 )){
+  warp.mm <- lmer(breaks ~ -1 + tension + (1|wool), data=warpbreaks)
+  LSmeans(warp.mm, effect="tension")
+  class(warp.mm)
+  fixef(warp.mm)
+  coef(summary(warp.mm))
+  vcov(warp.mm)
+  if (require(pbkrtest))
+    vcovAdj(warp.mm)
+ }
Loading required package: lme4
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘lme4’
> 
> LSmeans(warp.mm, effect="tension")
Error: object 'warp.mm' not found
Execution halted