Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error using set #2235

Closed
ELToulemonde opened this issue Jun 30, 2017 · 2 comments
Closed

Internal error using set #2235

ELToulemonde opened this issue Jun 30, 2017 · 2 comments

Comments

@ELToulemonde
Copy link

ELToulemonde commented Jun 30, 2017

Hello,

I'm having some issues with set function.

newColName <- paste(col_i, "Minus", col_j, sep = name_separator)

set(data, i=NULL, j=newColName, value=diffTime(data[[col_i]], data[[col_j]], units = units))

data is a data.table. col_i and col_j are colnames of data.

diffTime is a personnal function to compute differences between two dates:

diffTime <- function(col1, col2, units = "days"){
  if (units %in% c("auto", "secs", "mins", "hours", "days", "weeks")){
    return(as.numeric(difftime(col1, col2, units = units)))
  }
  if (units == "years"){
    return(as.numeric(difftime(col1, col2, units = "days")) / 365.25) # To-do: check number of days in years instead? 
  }
  else{
    stop("Sorry this unit hasn\'t been implemented yet")
  }
}

This line of code is generating following mistake:

Error in set(data, i = NULL, j = newColName, value = diffTime(data[[col_i]], : Internal error, please report (including result of sessionInfo()) to datatable-help: oldtncol (0) < oldncol (20) but tl of class is marked.

Did i made a mistake using set?

As asked: my sessionInfo():

R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] pander_0.6.0 kableExtra_0.2.1 knitr_1.16 dataPreparation_1.01.08 testthat_1.0.2 roxygen2_6.0.1
[7] devtools_1.13.2 stringr_1.2.0 lubridate_1.6.0 reshape2_1.4.2 data.table_1.10.4

loaded via a namespace (and not attached):
[1] Rcpp_0.12.11 xml2_1.1.1 magrittr_1.5 rvest_0.3.2 R6_2.2.2 highr_0.6 httr_1.2.1 plyr_1.8.4
[9] tools_3.3.3 git2r_0.18.0 withr_1.0.2 htmltools_0.3.6 commonmark_1.2 assertthat_0.2.0 yaml_2.1.14 rprojroot_1.2
[17] digest_0.6.12 crayon_1.3.2 memoise_1.1.0 evaluate_0.10.1 rmarkdown_1.6 stringi_1.1.5 desc_1.1.0 backports_1.1.0

@MichaelChirico
Copy link
Member

@ELToulemonde could you try running your code again?

Your error looks like it might be the same as was #2996 which was fixed in #3481

@ELToulemonde
Copy link
Author

Hello,

This is an old one, and I realise that my issue was not completly reproducible, sorry for that.

From what I can reproduce, It seems to work.

I close,

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants