I'm trying to run an R script, which can be found here with the command
plot_trace.R -m ./log.model.csv ./log.trace.csv.
The two csv files can be found here.
This produces the error:
Error in `:=`(variable, as.character(variable)) :
Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").
Calls: [ -> [.tbl_df -> check_names_df -> :=
Last but not least my sessionInfo() output:
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.4
Thanks
UPDATE
I found two problems with this script:
The author mixes functions from
tidyrand variables of classdata.table. These functions will likely return data frames and usingdata.tablesyntax on these will cause errors. Unfortunately, sometidyrfunctions may returndata.tablewhen operating on one, but this seems to vary greatly depending on the version of thetidyrpackage.The
unnestfunction fromtidyrhas a new interface. The script won't work as is withtidyrversion 1.0.0 or later.Below are the lines I changed to fix the script, using R version 3.6.1 and
tidyrversion 1.0.0:trace.df <- as.data.table(trace.df)trace.df <- unnest(trace.df, cols)trace.df <- as.data.table(trace.df)Original answer
I was able to run the script on the data you provided without error. Both
and
produced the following plot:
Can you run the script step by step in RStudio to check the class of
trace.dfafter each step?