>>>>> "BaRow" == Barry Rowlingson <[EMAIL PROTECTED]>
>>>>>     on Tue, 09 Jan 2007 14:53:05 +0000 writes:

    BaRow> 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))

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

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

    BaRow> Maybe you want this:
    >> sapply(objects(),function(x){dim(get(x))})
    BaRow> $f
    BaRow> NULL

    BaRow> $m
    BaRow> [1] 2 5

    BaRow> $x
    BaRow> NULL

    BaRow> $y
    BaRow> [1] 5 2

    BaRow> - where m and y are matrices, f is a function, x is a scalar.


Yes.
Since he's just interested in "print"ing, maybe

   ls.str()  # would be even more revealing (or maybe too
             #   confusing for a newbie)

Martin

______________________________________________
[email protected] 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