[R] lmer() and "$ operator is invalid for atomic vectors"

Angela Radulescu angela.radulescu at gmail.com
Thu Jul 30 23:37:56 CEST 2009


Hi all,

I am a bit mystified by this error message that I get when I try to apply
lmer() to a simple dataset with one between factor (age) and one within
factor (item): "$ operator is invalid for atomic vectors"

I'll just provide the code, because I don't see where the problem is: 


library(lme4)
options(contrasts=c("contr.helmert","contr.poly"))


data =
read.csv("C:/Users/Angela/Desktop/Summer_at_CDS/aging_JDM_Martine/datasets/lamda.data_07.27.09.csv",
header=TRUE) 
attach(data)

new<-data.frame(lamda, age.o_1, Item.l2_2,Subject)
new

Subject <- factor(Subject)
Age <- factor(age.o_1,levels=c("0","1"),labels=c("young","old"))
Item <- factor(Item.l2_2,levels=c("1","2"),labels=c("lamda1","lamda2"))

new2<-data.frame(lamda, Subject, Age, Item)
new2

new3 <- na.omit(new2)
new3
new4=as.data.frame(new3)


> (lmer.lamda <- lmer(lamda ~ Age*Item + ( 1 | Subject), lamda, data=new4))
Error in family$family : $ operator is invalid for atomic vectors


Here are the first 25 values of the dataframe lmer() should operate on: 

 lamda Subject   Age   Item
1     1.6000000       1   old lamda1
2     1.0434783       2   old lamda1
3     0.9600000       3   old lamda1
4     3.4285714       4   old lamda1
5     1.1428571       5   old lamda1
6     2.1818182       6   old lamda1
7     0.9600000       7   old lamda1
8     1.8461538       8   old lamda1
9     2.1818182       9   old lamda1
10    1.8461538      10   old lamda1
11    1.8461538      11   old lamda1
12    1.8461538      12   old lamda1
13    2.6666667      13   old lamda1
14    2.6666667      14   old lamda1
15    1.8461538      15   old lamda1
16    1.0434783      16   old lamda1
17    1.8461538      17   old lamda1
18    2.6666667      18   old lamda1
19    2.6666667      19   old lamda1
20    8.0000000      20   old lamda1
21    1.8461538      21   old lamda1
22    8.0000000      22   old lamda1
23    1.8461538      23   old lamda1
24    2.6666667      24   old lamda1
25    2.1818182      25   old lamda1


Any help would be much appreciated this one. I am in the dark and tried
pretty much everything... 

Many thanks,
Angela 

-- 
View this message in context: http://www.nabble.com/lmer%28%29-and-%22%24-operator-is-invalid-for-atomic-vectors%22-tp24747770p24747770.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list