I just ran into this. It took me a bit of digging but I found out what was happening.
I had a line of code 'rdevel <- tm_map(rdevel, asPlainTextDocument)'
Running this produced the error
In parallel::mclapply(x, FUN, ...) :
all scheduled cores encountered errors in user code
- It turns out that 'tm_map' calls some code in 'parallel' which attempts to figure out how many cores you have. To see what it's thinking, type
> getOption("mc.cores", 2L)
[1] 2
>
- Aha moment! Tell the 'tm_map' call to only use one core!
> rdevel <- tm_map(rdevel, asPlainTextDocument, mc.cores=1)
Error in match.fun(FUN) : object 'asPlainTextDocument' not found
> rdevel <- tm_map(rdevel, asPlainTextDocument, mc.cores=4)
Warning message:
In parallel::mclapply(x, FUN, ...) :
all scheduled cores encountered errors in user code
>
So ... with more than one core, rather than give you the error message, 'parallel' just tells you there was an error in each core. Not helpful, parallel!
I forgot the dot - the function name is supposed to be 'as.PlainTextDocument'!
So - if you get this error, add 'mc.cores=1' to the 'tm_map' call and run it again.