Re: [R] NAs and row/column calculations

2010-03-12 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 12.03.2010 00:20:39: On 12/03/2010, at 11:25 AM, Jim Bouldin wrote: I continue to have great frustrations with NA values--in particular making summary calculations on rows or cols of a matrix containing them. For example, why

[R] NAs and row/column calculations

2010-03-11 Thread Jim Bouldin
I continue to have great frustrations with NA values--in particular making summary calculations on rows or cols of a matrix containing them. For example, why does: a = matrix(1:30,nrow=5) is.na(a[c(1:2),c(3:4)]);a [,1] [,2] [,3] [,4] [,5] [,6] [1,]16 NA NA 21 26 [2,]2

Re: [R] NAs and row/column calculations

2010-03-11 Thread Greg Snow
Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Jim Bouldin Sent: Thursday, March 11, 2010 3:26 PM To: R help Subject: [R] NAs and row/column calculations I continue to have

Re: [R] NAs and row/column calculations

2010-03-11 Thread Rolf Turner
On 12/03/2010, at 11:25 AM, Jim Bouldin wrote: I continue to have great frustrations with NA values--in particular making summary calculations on rows or cols of a matrix containing them. For example, why does: a = matrix(1:30,nrow=5) is.na(a[c(1:2),c(3:4)]);a [,1] [,2] [,3] [,4]

Re: [R] NAs and row/column calculations

2010-03-11 Thread Jim Bouldin
On 12/03/2010, at 11:25 AM, Jim Bouldin wrote: I continue to have great frustrations with NA values--in particular making summary calculations on rows or cols of a matrix containing them. For example, why does: a = matrix(1:30,nrow=5) is.na(a[c(1:2),c(3:4)]);a [,1]

Re: [R] NAs and row/column calculations

2010-03-11 Thread RICHARD M. HEIBERGER
Jim, The next step for understanding what happens is to subset a complicated expression and see what its sub-pieces are doing. Since apply(a[!is.na(a)],2,sum) doesn't work, start by looking at each of the arguments to apply. You already verified that !is.na(a) gives what you want. Now take

Re: [R] NAs and row/column calculations

2010-03-11 Thread David Winsemius
On Mar 11, 2010, at 6:20 PM, Jim Bouldin wrote: On 12/03/2010, at 11:25 AM, Jim Bouldin wrote: I continue to have great frustrations with NA values--in particular making summary calculations on rows or cols of a matrix containing them. For example, why does: a =

Re: [R] NAs and row/column calculations

2010-03-11 Thread David Winsemius
On Mar 11, 2010, at 11:28 PM, David Winsemius wrote: On Mar 11, 2010, at 6:20 PM, Jim Bouldin wrote: On 12/03/2010, at 11:25 AM, Jim Bouldin wrote: I continue to have great frustrations with NA values--in particular making summary calculations on rows or cols of a matrix containing