Displaying 1 result from an estimated 1 matches for "megacap".
Did you mean:
mcg_cap
2011 Sep 08
2
Variable scoping question
...w)))
as.matrix(rev(sort(z))[1:5])
}
mysize()
When I test the lines inside the function it works fine:
> z <- sapply(ls(), function(w) object.size(get(w)))
> as.matrix(rev(sort(z))[1:5])
[,1]
mat 166344288
mod 130794704
zidx 799664
wfidx 799664
megacap 799664
>
But when I try to run the function, it produces an error:
> "mysize" <- function() {
+ z <- sapply(ls(), function(w) object.size(get(w)))
+ as.matrix(rev(sort(z))[1:5])
+ }
> mysize()
Error in rev(sort(z)) :
error in evaluating the argument 'x&...