While I'm aware this is incorrect use of the shift function, but if you forget to specify the type argument and use shift(val, "lead"), this causes Rstudio to crash.
Reproducible example
library(data.table)
dt <- data.table(
id = 1:5
, val = letters[1:5]
)
## This will crash RStudio
dt[, new_col := shift(val, "lead")]
## the fix is to specify `type = "lead"`
dt[, new_col := shift(val, type = "lead")]
Session info
devtools::session_info()
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 3.5.1 (2018-07-02)
os macOS 10.14.1
system x86_64, darwin15.6.0
ui RStudio
language (EN)
collate en_AU.UTF-8
ctype en_AU.UTF-8
tz Australia/Melbourne
date 2019-02-05
─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────
! package * version date lib source
assertthat 0.2.0 2017-04-11 [2] CRAN (R 3.5.0)
backports 1.1.2 2017-12-13 [2] CRAN (R 3.5.0)
callr 2.0.3 2018-04-11 [2] CRAN (R 3.5.0)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.0)
crayon 1.3.4 2017-09-16 [2] CRAN (R 3.5.0)
curl 3.3 2019-01-10 [1] CRAN (R 3.5.2)
V data.table * 1.12.0 2019-02-05 [1] Github (Rdatatable/data.table@e043dd2)
debugme 1.1.0 2017-10-22 [2] CRAN (R 3.5.0)
desc 1.2.0 2018-05-01 [2] CRAN (R 3.5.0)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.0)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.0)
fs 1.2.6 2018-08-23 [1] CRAN (R 3.5.0)
glue 1.3.0 2018-07-17 [2] CRAN (R 3.5.0)
magrittr 1.5 2014-11-22 [2] CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 [2] CRAN (R 3.5.0)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.0)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.0)
prettyunits 1.0.2 2015-07-13 [2] CRAN (R 3.5.0)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.0)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.0)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.0)
rlang 0.3.1 2019-01-08 [1] CRAN (R 3.5.2)
rprojroot 1.3-2 2018-01-03 [2] CRAN (R 3.5.0)
rstudioapi 0.8 2018-10-02 [1] CRAN (R 3.5.0)
sessioninfo 1.1.0 2018-09-25 [1] CRAN (R 3.5.0)
testthat 2.0.0 2017-12-13 [2] CRAN (R 3.5.0)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.0)
withr 2.1.2 2018-03-15 [2] CRAN (R 3.5.0)
[1] /Users/david/Library/R/3.5/library
[2] /Library/Frameworks/R.framework/Versions/3.5/Resources/library
V ── Loaded and on-disk version mismatch.
While I'm aware this is incorrect use of the
shiftfunction, but if you forget to specify thetypeargument and useshift(val, "lead"), this causes Rstudio to crash.Reproducible example
Session info