Re: [R] counting missing values

2003-06-06 Thread Uwe Ligges
[EMAIL PROTECTED] wrote: Hello R lovers I have written a little cute function to count the number of missing value per row in a matrix and return the percentage of missing value it takes a lot of time to run with a 1000 rows matrix I'd like to know if there is a function already implemented to

Re: [R] counting missing values

2003-06-06 Thread Torsten Hothorn
Hello R lovers I have written a little cute function to count the number of missing value per row in a matrix and return the percentage of missing value R M - matrix(rnorm(25), ncol=5) R diag(M) - NA R M[2,3] - NA R apply(M, 2, function(x) sum(is.na(x)))/ncol(M) [1] 0.2 0.2 0.4 0.2 0.2 the

RE: [R] counting missing values

2003-06-06 Thread Hotz, T.
Dear Vincent I'd like to know if there is a function already implemented to count the number of occurence of a given values in a vector Does my.matrix-cbind(c(0,1,NA),c(NA,1,NA)) count.NA-function(the.matrix){ result-t(apply(the.matrix,1,function(x,n){ m-sum(is.na(x)) c(m,m/n)

Re: [R] counting missing values

2003-06-06 Thread Peter Dalgaard BSA
Torsten Hothorn [EMAIL PROTECTED] writes: Hello R lovers I have written a little cute function to count the number of missing value per row in a matrix and return the percentage of missing value R M - matrix(rnorm(25), ncol=5) R diag(M) - NA R M[2,3] - NA R apply(M, 2, function(x)

Re: [R] counting missing values

2003-06-06 Thread Thomas Lumley
On Thu, 5 Jun 2003, Uwe Ligges wrote: [EMAIL PROTECTED] wrote: Hello R lovers I have written a little cute function to count the number of missing value per row in a matrix and return the percentage of missing value it takes a lot of time to run with a 1000 rows matrix I'd like to

RE: [R] counting missing values

2003-06-05 Thread Liaw, Andy
From: Uwe Ligges [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello R lovers I have written a little cute function to count the number of missing value per row in a matrix and return the percentage of missing value it takes a lot of time to run with a 1000 rows matrix