Re: [R] Need to incorporate the use of na.rm into custom function

2010-10-01 Thread Ochsner, Scott A
Behalf Of Jeffrey Spies Sent: Friday, October 01, 2010 10:13 AM To: Ochsner, Scott A Cc: r-help@r-project.org Subject: Re: [R] Need to incorporate the use of na.rm into custom function You can use na.omit on x after it is passed into your apply function if na.rm == T, or simply pass your na.rm to

Re: [R] Need to incorporate the use of na.rm into custom function

2010-10-01 Thread Jeffrey Spies
You can use na.omit on x after it is passed into your apply function if na.rm == T, or simply pass your na.rm to functions that use it, such as sum. Hope that helps, Jeff. On Fri, Oct 1, 2010 at 11:07 AM, Ochsner, Scott A wrote: > Hi, > > Take a matrix with missing values: > >> X = matrix(rnorm

[R] Need to incorporate the use of na.rm into custom function

2010-10-01 Thread Ochsner, Scott A
Hi, Take a matrix with missing values: > X = matrix(rnorm(10), ncol = 5) > X[2,4]=NA > X [,1] [,2] [,3] [,4] [,5] [1,] -0.1566427 -0.7382232 -1.0564624 -0.8412139 0.9370319 [2,] -1.0289865 -0.8452054 -0.1349459 NA -0.1749113 I want to apply a custom fu