Re: [R] info() function?

2006-03-08 Thread Henrik Bengtsson
library(R.oo)
ll()
 member data.class dimension object.size
1 anumeric  10004028
2author  character 1 112
3   expnumeric 1  36
4  last.warning   list 2 488
5object   function  NULL 864
6   row  character 1  72
7 USArrests data.frame   c(50,4)4076
8  VADeaths matrixc(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 anumeric  10004028
2author  character 1 112
3   expnumeric 1  36
4  last.warning   list 2 488
5   naCount   function  NULL 864
6object   function  NULL 864
7properties  character 4 212
8   row  character 1  72
9 USArrests data.frame   c(50,4)4076
10 VADeaths matrixc(5,4) 824
11value  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 [EMAIL PROTECTED] 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@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@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


Re: [R] info() function?

2006-03-08 Thread Gabor Grothendieck
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 [EMAIL PROTECTED] wrote:
 library(R.oo)
 ll()
 member data.class dimension object.size
 1 anumeric  10004028
 2author  character 1 112
 3   expnumeric 1  36
 4  last.warning   list 2 488
 5object   function  NULL 864
 6   row  character 1  72
 7 USArrests data.frame   c(50,4)4076
 8  VADeaths matrixc(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 anumeric  10004028
 2author  character 1 112
 3   expnumeric 1  36
 4  last.warning   list 2 488
 5   naCount   function  NULL 864
 6object   function  NULL 864
 7properties  character 4 212
 8   row  character 1  72
 9 USArrests data.frame   c(50,4)4076
 10 VADeaths matrixc(5,4) 824
 11value  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 [EMAIL PROTECTED] 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@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@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


__
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