I am trying to reproduce a simplified version of the R output described in this posting . More generally, this is related to my attempt to use the stargazer()
function to generate a LaTex table from an lmer
object.
Following the author's posting, I've loaded the appropriate libraries and successfully created two lmer
objects using the following code:
library(lme4)
library(stargazer)
data(cake)
M1 <- lmer(angle ~ temp + (1 | replicate) + (1|recipe:replicate), cake, REML= FALSE)
M2 <- lmer(angle ~ factor(temperature) + (1 | replicate) + (1|recipe:replicate), cake, REML= FALSE)
When I attempt the following code, it returns the error below:
stargazer(M1, M2, style="ajps",
title="An Illustrative Model Using Cake Data",
dep.var.labels.include = FALSE,
covariate.labels=c( "Temperature (Continuous)",
"Temperature (Factor $<$ 185)",
"Temperature (Factor $<$ 195)",
"Temperature (Factor $<$ 205)",
"Temperature (Factor $<$ 215)",
"Temperature (Factor $<$ 225)"))
Error in objects[[i]]$zelig.call : $ operator not defined for this S4 class
I do not understand the source of this error, nor how to remedy it, and I would be greatly appreciative of any help.
I am using RStudio version 0.99.441 in Desktop Mode.
My R version info is as follow:
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major 3
minor 2.0
year 2015
month 04
day 16
svn rev 68180
language R
version.string R version 3.2.0 (2015-04-16)
nickname Full of Ingredients
My version of the stargazer
package is 5.1, and my version of lme4
is 1.1-7
You may add the following codes before you run stargazer
.
class(M1) <- "lmerMod"
class(M2) <- "lmerMod"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.