[R] repeated measures with missing data

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jul 5 12:40:02 CEST 2010


On Mon, Jul 5, 2010 at 4:00 AM, ONKELINX, Thierry
<Thierry.ONKELINX at inbo.be> wrote:
> Dear Rafael,
>
> The line below had one closing bracket to much. The line below should
> work.
>
> am2 <- lmer(dv ~ myfactor + (1|subject), data = mydata)
>
> Furthermore I would advise to change myfactor for a character variable
> to a factor.
>

In addition, you can simplify the data manipulation:

wide <- matrix(c(20, 26, 16, 29, 22, NA, 12, 24, 17, 21, NA, 17), nrow = 6,
  dimnames = list(subject = paste("s", 1:6, sep = ""), myfactor =
c("f1", "f2")))

long <- as.data.frame.table(wide, responseName = "dv")

am2 <- lmer(dv ~ myfactor + (1|subject), data = long)



More information about the R-help mailing list