On 2/25/2008 8:59 AM, Angelo Passalacqua wrote:
I am aware of
table(is.na(df$var))
but is there an efficient way of create a table that shows the number of
missing values in each variable of a data frame?
Right now I am forced to create a new variable, varna-is.na(df$var), for
each variable of the data frame, bind them to a new data frame and tabulate
it, but surely there is a simpler way?
any help is greatly appreciated,
angelo
Are you looking for colSums(is.na(df)) or colMeans(is.na(df)) ? The
is.na function can be applied to whole data frames.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.