Re: [R] dimensions of a all objects

From: Barry Rowlingson <b.rowlingson_at_lancaster.ac.uk>
Date: Tue 09 Jan 2007 - 14:53:05 GMT

Farrel Buchinsky wrote:
> Why will the following command not work
> sapply(objects(),dim)
> What does it say about the objects list? What does it say about the dim
> command?
>
> Likewise, the following also does not work
> all<-ls()
> for (f in all) print(dim(f))

   'objects()' returns character strings - the names of objects - then the dim of the character strings are all NULL.

  I'll assume that's what you are getting at - you've not posted an example or the output you are getting or why it 'does not work'.

  Maybe you want this:
  > sapply(objects(),function(x){dim(get(x))})   $f
  NULL   $m
  [1] 2 5

  $x
  NULL   $y
  [1] 5 2

Barry



R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Wed Jan 10 10:33:13 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 10 Jan 2007 - 00:30:25 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.