Re: [R] SAPPLY function XXXX

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Thu, 05 May 2011 06:41:41 +0200

Hi

r-help-bounces_at_r-project.org napsal dne 04.05.2011 22:26:59:

> Erik Iverson <eriki_at_ccbr.umn.edu>
> Odeslal: r-help-bounces_at_r-project.org
>
> 04.05.2011 22:26
>
> Komu
>
> Dan Abner <dan.abner99_at_gmail.com>
>
>
> > Ultimately, I would like for this to be 1 conponent in a larger
function
> > that will produce PROC CONTENTS style output. Something like...
> >
> > data1.contents<-data.frame(Variable=names(data1),
> > Class=sapply(data1,class),

> > n.valid=sapply(data1,sum(!is.na)),

> > n.miss=sapply(data1,sum(is.na)))
> > data1.contents
>
> Also meant to mention to see ?describe in the Hmisc package:
>
> E.g.,
>
> > describe(c(NA, 1:10))
>
> There is also a useful method for data.frame objects.

colSums(is.na(data1))
colSums(!is.na(data1))

may also show number of missing and nonmissing values in data frame.

Regards
Petr

>
> --Erik
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Thu 05 May 2011 - 06:25:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 May 2011 - 07:00:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive