# NOT RUN {
library(emmeans)
library(lme4)
data(data)
#Simple lm model
luke=lm(Petal.Width~Species,data=iris)
vador=emmeans(luke,~Species)
report.lsmeans(vador,"Species")
# In case of just one intercept, x1.name="X1"
lucky=glm(Species~1,data=iris,family=binomial)
strike=emmeans(lucky,~1)
report.lsmeans(strike,"X1")
#Mixed model example using lme4
james=lmer(y_numeric~GROUP+TIMEPOINT+GROUP*TIMEPOINT+(1|SUBJID),data=data)
bond=emmeans(james,~GROUP|TIMEPOINT)
report.lsmeans(lsm=bond,x1.name="GROUP",x2.name="TIMEPOINT",at.row="TIMEPOINT")
# }
Run the code above in your browser using DataLab