This line of code works fine when I 'run' it in Rstudio
dt.SSPGDP[, GDP.lag1 :=shift(value), by=c("ISO_code","scenario")]
But when I run devtools::load_all(), I get the following error message
Error in `:=`(GDP.lag1, shift(value)) (from dataManagement.alcohol.R#37) :
Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").
I checked that dt.SSPGDP is in fact a data table.
Any tips on how to fix?