-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hi,
I think I like this package, but it does seem to not support data.table.
The code below does identical things, except that once it uses data.table and once data.frame. The latter works while the former does not.
rm(list = ls())
N_pop <- 100
dat_frame <- data.frame(x = rnorm(N_pop, 10, 1))
mean(dat_frame$x)
func_frame <- function(N_pop, N_samp){
tmp <- dat_frame[sample(seq(1:N_pop), N_samp),]
return(list("mean" = mean(tmp)))
}
func_frame(N_pop, 10)
MC <- MonteCarlo(func = func_frame, nrep = 100, param_list = list("N_pop" = N_pop, "N_samp" = 10), ncpus = 4)
N_pop <- 100
dat_table <- data.table(x = rnorm(N_pop, 10, 1))
mean(dat_table$x)
func_table <- function(N_pop, N_samp){
tmp <- dat_table[sample(seq(1:N_pop), N_samp),]
return(list("mean" = mean(tmp$x)))
}
func_table(N_pop, 10)
MC <- MonteCarlo(func = func_table, nrep = 100, param_list = list("N_pop" = N_pop, "N_samp" = 10), ncpus = 4)
Metadata
Metadata
Assignees
Labels
No labels