Sorry for my late reply.

Thank you so much Jim. This script of yours
is very2 useful. I have used it.

- Gundala Viswanath
Jakarta - Indonesia



On Wed, Jan 14, 2009 at 12:17 AM, jim holtman <jholt...@gmail.com> wrote:
> Here is a function I use to see how big the objects in my workspace are:
>
>> my.ls <-
> + function (pos = 1, sorted = F)
> + {
> +     .result <- sapply(ls(pos = pos, all.names = TRUE), function(..x)
> object.size(eval(as.symbol(..x))))
> +     if (sorted) {
> +         .result <- rev(sort(.result))
> +     }
> +     .ls <- as.data.frame(rbind(as.matrix(.result), `**Total` = 
> sum(.result)))
> +     names(.ls) <- "Size"
> +     .ls$Size <- formatC(.ls$Size, big.mark = ",", digits = 0,
> +         format = "f")
> +     .ls$Mode <- c(unlist(lapply(rownames(.ls)[-nrow(.ls)],
> function(x) mode(eval(as.symbol(x))))),
> +         "-------")
> +     .ls
> + }
>> my.ls()
>              Size        Mode
> .my.env         28 environment
> .Random.seed 2,528     numeric
> .required       72   character
> my.ls        6,712    function
> **Total      9,340     -------
>
>
> On Tue, Jan 13, 2009 at 9:53 AM, Gundala Viswanath <gunda...@gmail.com> wrote:
>> Dear all,
>>
>> Is there a way we can find the total object.size of
>> all the objects in our R script?
>>
>> The reason we want to do this because we want to know
>> how much memory does our R script require overall.
>>
>> Rprofmem(), doesn't seem to do it.
>>
>> and Unix 'top' command is dynamic and
>> it doesn't give the exact byte size.
>>
>> - Gundala Viswanath
>> Jakarta - Indonesia
>>
>> ______________________________________________
>> R-help@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.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>

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

Reply via email to