Mixed ANOVA (lme) returns error for alphabetic variable


5 weeks ago


12 time


I have a large data set with persons who answered questionnaires at several measurement points. I want to run an ANOVA using the lme function with my "SERIAL" variable as identifying the persons (which is the serial code of a person in letters and numbers, e.g. YVEDPEPGV9). So person YVEDPEPGV9 answers the RRS and PSWQ questionnaires at two times (see below).

Unfortunately R returns an error and tells me that operations are only possible for numeric, logical and complex types. Do I need to recode the SERIAL variable into a variable which assigns only numbers to every person? Or is there a way that R accepts the variable as assigning variable? If I have to create a new variable, which would be the smartest way to assign an identifying number to every person (to every Serial Code)?

This is my code for the ANOVA so far:

anova_lme <-lme(data=ds, fixed=ABB~group * RRS * PSWQ,  
                         random=1|"SERIAL", na.action=na.omit)

between = group

within = RRS and PSWQ

0 answers