Skip to content

Simple Missing cases Function

7 messages · Tim Elwell-Sutton, PIKAL Petr, Philipp Pagel +1 more

#
Hi

Hi
try

colSums(is.na(data.m))

It is not in data frame but you can easily transform it if you want.

Regards
Petr


r-help-bounces at r-project.org napsal dne 19.04.2011 09:29:08:
I
each
because I
http://www.R-project.org/posting-guide.html
#
On Tue, Apr 19, 2011 at 03:29:08PM +0800, Tim Elwell-Sutton wrote:
Why not use summary?
a               b        c    
 Min.   :1.000   Min.   :4   A   :2  
 1st Qu.:2.000   1st Qu.:5   B   :1  
 Median :3.000   Median :6   NA's:1  
 Mean   :2.667   Mean   :6           
 3rd Qu.:3.500   3rd Qu.:7           
 Max.   :4.000   Max.   :8           
 NA's   :1.000   NA's   :2      

cu
	Philipp
#
On Tue, Apr 19, 2011 at 03:29:08PM +0800, Tim Elwell-Sutton wrote:
Oh - and in case you ONLY wnt the number of NAs in each column this
should be pretty efficient:

lapply(foo, function(x){sum(is.na(x))})

cu
	Philipp
#
Dear Petr
Thanks so much. That is a LOT more efficient.
Tim

-----Original Message-----
From: Petr PIKAL [mailto:petr.pikal at precheza.cz] 
Sent: Tuesday, April 19, 2011 3:37 PM
To: tesutton
Cc: r-help at r-project.org
Subject: Odp: [R] Simple Missing cases Function

Hi

Hi
try

colSums(is.na(data.m))

It is not in data frame but you can easily transform it if you want.

Regards
Petr


r-help-bounces at r-project.org napsal dne 19.04.2011 09:29:08:
I
each
because I
http://www.R-project.org/posting-guide.html