[R] info() function?

Gabor Grothendieck ggrothendieck at gmail.com
Wed Mar 8 14:46:36 CET 2006


Another possibility is eapply where I have used naCount
from Henrik's solution:

prop <- function(x)
 list(class = data.class(x), dim = dim(x), size = object.size(x), NAs
= naCount(x))
do.call("rbind", eapply(.GlobalEnv, prop))


On 3/8/06, Henrik Bengtsson <hb at maths.lth.se> wrote:
> >library(R.oo)
> >ll()
>         member data.class dimension object.size
> 1             a    numeric      1000        4028
> 2        author  character         1         112
> 3           exp    numeric         1          36
> 4  last.warning       list         2         488
> 5        object   function      NULL         864
> 6           row  character         1          72
> 7     USArrests data.frame   c(50,4)        4076
> 8      VADeaths     matrix    c(5,4)         824
> 9         value  character         1          72
>
> with NA counts:
> >naCount <- function(x, ...) ifelse(is.vector(x), sum(is.na(x)), NA)
> >properties <- c("data.class", "dimension", "object.size", "naCount")
> ll(properties=properties)
>         member data.class dimension object.size
> 1             a    numeric      1000        4028
> 2        author  character         1         112
> 3           exp    numeric         1          36
> 4  last.warning       list         2         488
> 5       naCount   function      NULL         864
> 6        object   function      NULL         864
> 7    properties  character         4         212
> 8           row  character         1          72
> 9     USArrests data.frame   c(50,4)        4076
> 10     VADeaths     matrix    c(5,4)         824
> 11        value  character         1          72
>
> FYI: In next version of R.oo, there will probably be some kind of
> option to set the default 'properties' argument so that this must not
> be given explicitly by default.
>
> Cheers
>
> Henrik
>
> On 3/8/06, Robert Lundqvist <Robert.Lundqvist at ltu.se> wrote:
> > I would like to have some function for getting an overview of the
> > variables in a worksheet. Class, dimesions, length, number of missing
> > values,... Guess it wouldn't be that hard to set up such a function, but I
> > guess there are others who have made it already. Or is it already a
> > standard feature in the base package? Any suggestions?
> >
> > Robert
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> >
>
>
> --
> Henrik Bengtsson
> Mobile: +46 708 909208 (+1h UTC)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list