Re: [R] Summing up columns with NA elements in a data frame

2008-09-23 Thread Henrique Dallazuanna
Try this: a$a4 <- rowSums(a, na.rm = T) On Tue, Sep 23, 2008 at 12:20 PM, ravi <[EMAIL PROTECTED]> wrote: > Hi all, > When I try to sum a few columns in a data frame (which has NA's randomly > distributed as elements), I am not able to get the summing operation to > ignore the NA's. > Let me ex

[R] Summing up columns with NA elements in a data frame

2008-09-23 Thread ravi
Hi all, When I try to sum a few columns in a data frame (which has NA’s randomly distributed as elements), I am not able to get the summing operation to ignore the NA’s. Let me explain with the following code :   a<-structure(list(a1 = c(NA, 2, 3, NA, 5, 6, NA, 8,