Re: [R] SAPPLY function XXXX

From: Erik Iverson <eriki_at_ccbr.umn.edu>
Date: Wed, 04 May 2011 15:26:59 -0500

> 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.

--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. Received on Thu 05 May 2011 - 06:25:13 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:07 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