Warnings suppressed with mclapply in R -


with mclapply() issued warnings seems suppressed:

library(multicore)  mclapply(1:3, function(x) warning(x)) [[1]] [1] "1"  [[2]] [1] "2"  [[3]] [1] "3" 

while lapply give:

lapply(1:3, function(x) warning(x)) [[1]] [1] "1"  [[2]] [1] "2"  [[3]] [1] "3"  warning messages: 1: in fun(1:3[[3l]], ...) : 1 2: in fun(1:3[[3l]], ...) : 2 3: in fun(1:3[[3l]], ...) : 3 

any tips on how avoid loosing warnings?

according mclapply's page, in opinion argument mc.silent should allow chose if warnings printed or not. strangely, not that. setting explictly true or false not have effect in situation.

so leaves dirty hack: forcing r print warnings occur.

options(warn=1) mclapply(1:3, function(x) warning(x))  # warning in fun(1l[[1l]], ...) : 1 # warning in fun(2l[[1l]], ...) : 2 # warning in fun(3l[[1l]], ...) : 3 # [[1]] # [1] "1" # # [[2]] # [1] "2" # # [[3]] # [1] "3" 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -