[Rd] Defunct of --max-vsize and mem.limits

2012-09-22 Thread qwumd
 
R-devel,

I am migrating from R.2.13.2 to R.2.15.1 and just realize that R command line 
options --max-nsize and --max-vsize are no longer supported along with the 
defunct of mem.limits(). To me, the function and options along with other two, 
--min-nsize and --min-vsize, are useful in allowing some explicit control of R 
memory usage. One benefit is that the setting of maximum boundary could prompt 
gc() to be triggered at specific point and prevent R from holding memory 
resources unnecessarily, or gc() could be postponed too much. This can also 
serve a way to manually balance the resources and performance between R and 
other processes that are running on the same system.

Could anyone in R core team share the reason behind the decision of defuncting 
this memory upper bound feature ? Is this functionality covered in R-2.15.1 by 
other means ? In particular, without --max-vsize in R-2.15.1, how can I set 
maximum memory limits when running embedded R ?
 
Thanks,
 
Quin
[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] lapply coerce data.frame to a list

2013-03-06 Thread qwumd

Hi R-devel,

When using lapply upon data.frame, I notice lapply coerces data.frame to list 
before calling internal lapply function.

R> lapply
function (X, FUN, ...) 
{
    FUN <- match.fun(FUN)
    if (!is.vector(X) || is.object(X)) 
    X <- as.list(X)
    .Internal(lapply(X, FUN))
}

df <- data.frame(V1=seq(100*1024*1024), V2=rnorm(100*1024))

R> is.vector(df)    # btw, list is a vector, data.frame is a list, but 
data.frame is NOT a vector, something is not consistent ??
[1] FALSE

X <- as.list(X) is executed and takes time for large data.frame
R> object.size(df)
1258291976 bytes
R> system.time(as.list(df))
   user  system elapsed 
  1.396   0.472   1.885 

The question is: Given that data.frame is a list, is it necessary to coerce the 
data.frame to a list for lapply?

Would the following logic do the same but more efficient for lapply to run on 
data.frame?

 if (!is.vector(X) && !is.list(X) || is.object(X)) 
    X <- as.list(X)
    .Internal(lapply(X, FUN))

Thanks,

Qin
[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel