[R] SAPPLY function XXXX

Erik Iverson eriki at ccbr.umn.edu
Wed May 4 22:26:59 CEST 2011


> 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



More information about the R-help mailing list