See https://cran.r-project.org/web/packages/data.table/vignettes/datatable-faq.html#why-do-i-have-to-type-dt-sometimes-twice-after-using-to-print-the-result-to-console Reproducible example: ```{r} range_example_wide <- data.table::setDT(scoringutils::range_example_data_wide) range_example <- scoringutils::range_wide_to_long(range_example_wide) ``` Typing `range_example` afterwards does not print the contents of the data frame. Typing it again does. Solution is to explicitly call `DT[]` before returning any `data.table` that has been modified using `:=`.
See https://cran.r-project.org/web/packages/data.table/vignettes/datatable-faq.html#why-do-i-have-to-type-dt-sometimes-twice-after-using-to-print-the-result-to-console
Reproducible example:
Typing
range_exampleafterwards does not print the contents of the data frame. Typing it again does.Solution is to explicitly call
DT[]before returning anydata.tablethat has been modified using:=.