[R] dimensions of a all objects

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Jan 9 15:47:38 CET 2007


You need something like this: 
sapply(objects() , function(x)(dim(eval(parse(text = x)))))

a <- rnorm(1)
b <- matrix(rnorm(4), ncol = 2, nrow = 2)
sapply(objects() , function(x)(dim(eval(parse(text = x)))))

$a
NULL

$b
[1] 2 2

Cheers,

Thierry

------------------------------------------------------------------------
----

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

Thierry.Onkelinx op inbo.be

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-help-bounces op stat.math.ethz.ch
[mailto:r-help-bounces op stat.math.ethz.ch] Namens Farrel Buchinsky
Verzonden: dinsdag 9 januari 2007 15:30
Aan: r-help op stat.math.ethz.ch
Onderwerp: [R] dimensions of a all objects

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))
-- 
Farrel Buchinsky

	[[alternative HTML version deleted]]

______________________________________________
R-help op 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.



More information about the R-help mailing list