> Michael writes:
> I can use data() to find the available datasets in a package, but I'd 
> like to extract and display some additional
> information for each dataset  than what is provided by data(), e.g., 
> class() and dim() for datasets for which
> these are available.
> ...
> for all datasets in Item, giving a display like
> 
> Item      class       dim     Title
> Abortion  table       2x2x2   Abortion Opinion Data
> Mental    data.frame  24x2    Mental impariment and parents SES

This seems to work on your example:
require('vcdExtra')
ds <- as.data.frame(data(package="vcdExtra")$results[,c('Item','Title')], 
stringsAsFactors=FALSE)
ds$dim <- lapply(ds$Item, function(x) { paste(dim(get(x)), collapse='x') } 
)
ds$class <- lapply(ds$Item, function(x) { class(get(x)) } )
ds <- ds[c('Item','class','dim','Title')]

Thanks for the fun exercise.  I've just started looking at the various 
'apply-oid' functions, having spent much of my time with aggregate() and 
perhaps having my imagination stunted.

cur
-- 
Curt Seeliger, Data Ranger
Raytheon Information Services - Contractor to ORD
seeliger.c...@epa.gov
541/754-4638


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

Reply via email to