Re: [R] Problem with NA data when computing standard error

2012-04-05 Thread apcoble
I found a rather easy solution that circumvents this problem by: 1) creating your own length function using na.omit function 2) calculating variance using tapply 3) calculating length using new length function 4) calculating square root of variance by length *Code from LeCzar:* object1<-as.d

Re: [R] Problem with NA data when computing standard error

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 12:44 PM, LeCzar <[EMAIL PROTECTED]> wrote: > > Hey, > > I want to compute means and standard errors as two tables like this: > > se<-function(x)sqrt(var(x)/length(x)) > > The missings are not your main problem. The command var computes the variance-covariance matrix.

Re: [R] Problem with NA data when computing standard error

2008-04-08 Thread Jorge Velez
Hi there, Perhaps se<-function(x)sqrt(var(x,na.rm=T)/sum(!is.na(x))) object1<-as.data.frame.table(tapply(Data[Year=="1999"],list(Group[Year=="1999"],Season[Year=="1999"]),mean)) object2<-as.data.frame.table(tapply(Data[Year=="1999"],list(Group[Year=="1999"],Season[Year=="1999"]),se)) Hope this

[R] Problem with NA data when computing standard error

2008-04-08 Thread LeCzar
Hey, I want to compute means and standard errors as two tables like this: se<-function(x)sqrt(var(x)/length(x)) object1<-as.data.frame.table(tapply(Data[Year=="1999"],na.rm=T,list(Group[Year=="1999"],Season[Year=="1999"]),mean)) object2<-as.data.frame.table(tapply(Data[Year=="1999"],na.rm=