[R] R: to view the memory

Henrik Bengtsson hb at stat.berkeley.edu
Thu Sep 13 03:04:59 CEST 2007


For listings, you have ls(), ls.str(), and also ll() in R.oo, e.g.

> library(R.oo)
R.oo v1.3.0 (2006-08-29) successfully loaded. See ?R.oo for help.

> data(USArrests)
> data(lynx)
> data(Nile)
> data(iris3)
> data(iris)
> data(euro)

> ls()
[1] "euro"       "euro.cross" "iris"       "iris3"
[5] "lynx"       "Nile"       "USArrests"

> ls.str()
euro :  Named num [1:11]  13.76  40.34   1.96 166.39   5.95 ...
euro.cross :  num [1:11, 1:11] 1.0000 0.3411 7.0355 0.0827 2.3143
iris : 'data.frame':    150 obs. of  5 variables:
 $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
 $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
 $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
 $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
 $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1
1 ...
iris3 :  num [1:50, 1:4, 1:3] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9
lynx :  Time-Series [1:114] from 1821 to 1934:  269  321  585  871
Nile :  Time-Series [1:100] from 1871 to 1970: 1120 1160 963 1210
1230 1370 1140 ...
USArrests : 'data.frame':       50 obs. of  4 variables:
 $ Murder  : num  13.2 10 8.1 8.8 9 7.9 3.3 5.9 15.4 17.4 ...
 $ Assault : int  236 263 294 190 276 204 110 238 335 211 ...
 $ UrbanPop: int  58 48 80 50 91 78 77 72 80 60 ...
 $ Rape    : num  21.2 44.5 31 19.5 40.6 38.7 11.1 15.8 31.9 25.8

> ll()
      member data.class dimension objectSize
1       euro    numeric        11        632
2 euro.cross     matrix  c(11,11)       2016
3       iris data.frame  c(150,5)       6424
4      iris3      array c(50,4,3)       5368
5       lynx         ts       114       1168
6       Nile         ts       100       1056
7  USArrests data.frame   c(50,4)       3824

Cheers

Henrik

On 9/12/07, Bert Gunter <gunter.berton at gene.com> wrote:
> You probably should be inserting browser() calls into your function instead
> -- once there you can list and examine all variables at whatever state your
> function is in. (and debugging is specifically what browser() was designed
> for).
>
> See ?browser()
>
>
> Bert Gunter
> Genentech Nonclinical Statistics
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Sumit.Gupta at ubs.com
> Sent: Tuesday, September 11, 2007 7:02 PM
> To: r-help at r-project.org
> Subject: [R] R: to view the memory
>
> Hello,
>
> I am wondering if it is possible to view what variables and vairable
> values are stored in the R memory. This to enable debugging of R-scripts
> I write.
>
> Sumit
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>
> ______________________________________________
> R-help at r-project.org 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