2

I got an Error while I trying to create an environment contains lots of virables.

It happened in Rstudio Server on Ubuntu & reproducable in Rstudio on macOS.

The following code could reproduce it. From fast single item lookup from list vs data.table vs hash

# Set seed to 42 to ensure repeatability
set.seed(42)

# Generate product ids
product_ids <- as.vector(
  outer(LETTERS[seq(1, 26, 1)],
        outer(outer(LETTERS[seq(1, 26, 1)], LETTERS[seq(1, 26, 1)], paste, sep=""),
              LETTERS[seq(1, 26, 1)], paste, sep = ""
        ), paste, sep = ""
  )
)

# Create test lookup data
test_lookup_list <- lapply(product_ids, function(id){
  return_list <- list(
    product_id = id,
    val_1 = rnorm(1),
    val_2 = rnorm(1),
    val_3 = rnorm(1),
    val_4 = rnorm(1),
    val_5 = rnorm(1),
    val_6 = rnorm(1),
    val_7 = rnorm(1),
    val_8 = rnorm(1)
  )
  return(return_list)
})

# Set names of items in list
names(test_lookup_list) <- sapply(test_lookup_list, function(elem) elem[['product_id']])

test_lookup_env <- list2env(test_lookup_list)

sessionInfo:

Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblasp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=C              LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0    packrat_0.5.0 

I've searched for that and there were many suggestion about start R using argument --max-ppsize=5000000, but it seems not working with many post complained, and I don't know how to do it for a RStudio Server. If there's some suggestion, it will be very helpful. Thank you.

xiaguoxin
  • 21
  • 3

0 Answers0