Re: [R] Newbie needs to count elements in a row

2009-12-29 Thread John Kane
1, gl) == -- On Tue, 12/29/09, Verena Weber wrote: > From: Verena Weber > Subject: [R] Newbie needs to count elements in a row > To: r-help@r-project.org > Received: Tuesday, December 29, 2009, 8:49 AM > Hi, > > I have a n

Re: [R] Newbie needs to count elements in a row

2009-12-29 Thread Nutter, Benjamin
2009 8:50 AM To: r-help@r-project.org Subject: [R] Newbie needs to count elements in a row Hi, I have a n*m matrix and would like to count the number of elements not equal to NA in a ROW. e.g. x 1 2 3 NA 10 y 2 NA 8 9 NA Which function can I use to obtain "4" for row x and "3&q

Re: [R] Newbie needs to count elements in a row

2009-12-29 Thread Henrique Dallazuanna
Try this: rowSums(!is.na(x)) On Tue, Dec 29, 2009 at 11:49 AM, Verena Weber wrote: > Hi, > > I have a n*m matrix and would like to count the number of elements not equal > to NA in a ROW. > > e.g. > > x 1 2 3 NA 10 > y 2 NA 8 9 NA > > Which function can I use to obtain > "4" for row x and > "3"

[R] Newbie needs to count elements in a row

2009-12-29 Thread Verena Weber
Hi, I have a n*m matrix and would like to count the number of elements not equal to NA in a ROW. e.g. x 1 2 3 NA 10 y 2 NA 8 9 NA Which function can I use to obtain "4" for row x and "3" for row y? Could you help me? I found some functions for columns but not for rows... Thank you very muc