I don't know, but here is a trick I often use when I'm debugging something in R:
put this line on top of the R script:
debugpath <- paste0("D:/Zorro/Strategy/RWDLexample.rda")
//the *.rda file is a complete memory snapshot. Put it anywhere you like.
neural.train <- function(model, XY) {
save.image(debugpath)
#load(debugpath)
....
(just add these two lines)
Beware: every neural.train function call will save a complete memory snapshot
Now when I'm debugging, I first clear the R session in RStudio, then source the R file and then execute
load(debugpath)
Then I can check line by line what's happening.