Closed arni-magnusson closed 6 years ago
@arnima-github here is a small example:
tmpffile <- tempfile(fileext = ".R")
cat("library(data.table)
n <- 1000
df <- data.frame(catch_this = 1:n,
y = rnorm(n),
cat = sample(letters[1:3], n, replace = TRUE))
dt <- data.table(df)
dt_sd <- dt[,.SD[which(catch_this > 1)], by = cat]
", file = tmpffile)
icesTAF::sourceTAF(tmpffile)
# [14:24:59] Running C:\Users\colin\AppData\Local\Temp\RtmpeQlU0D\file3ecc75483269.R ...
# Error in which(catch_this > 1) : object 'catch_this' not found
# Failed
icesTAF::sourceTAF(tmpffile, local = FALSE)
# [14:26:22] Running C:\Users\colin\AppData\Local\Temp\RtmpeQlU0D\file3ecc75483269.R ...
# Done
source(tmpffile)
The local
argument proved to be problematic, so went back to rm
argument instead.
@arnima-github I found a quirk in this when useing data.table commands. I will repl
All the above OK, but souceTAF not…. Very odd!
If it helps, the line of code is here:
dt.max <- dt[,.SD[which(Score == max(Score))],by = CSquare]
I will try and get a small reproducible example