apply with missing values
On Dec 24, 2012, at 11:21 AM, jenna wrote:
I am trying to get the means of each participants avg saccade amplitude as a function of the group they were in (designated by "shape_"), but there are missing values in the dataset....this is what i tried... with(data055,tapply(AVERAGE_SACCADE_AMPLITUDE,shape_,mean)) i get an error saying the argument is not numerical or logical
The error message appears informative (and would NOT be expected to be solved by adding na.rm=TRUE). Your construction of the data055 dataframe was flawed in some way. You have not shown how it was done nor given dput(head(data055)) which would have provided a basis for further assessment. Based on past experience my guess is that there was a character value in the column of data you thought was numeric during a read.* operation and is now a factor.
next i try...
055 <- tapply(data055$AVERAGE_SACCADE_AMPLITUDE,
+ data055$shape_,mean, na.rm =TRUE) still nothing....
David Winsemius, MD Alameda, CA, USA