You should be aware that data.table and DT::datatable are very different things, so it's possible you have confused these. As you are already using the tidyverse function read_csv I suspect this is the case.
The error message is likely because you have not loaded data.table via: library(data.table)
The tidyverse/dplyr equivalent would be something like dt %>% summarise(x = sum(a))
For any further help re the plots you should produce a reproducible example: