Skip to content
Back to formatted view

Raw Message

Message-ID: <405CBA2B-A3B7-4407-A1C3-BF19800F7167@comcast.net>
Date: 2012-12-25T21:37:45Z
From: David Winsemius
Subject: apply with missing values
In-Reply-To: <1356376908783-4653889.post@n4.nabble.com>

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