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

Crashing Rstudio when combining J(), function, by = .EACHI, and nomatch = 0. #1933

Closed
ProfFancyPants opened this issue Nov 28, 2016 · 4 comments
Milestone

Comments

@ProfFancyPants
Copy link

@ProfFancyPants ProfFancyPants commented Nov 28, 2016

Hi guys,

I found a potential bug that crashes Rstudio all together. Here is the reproducible example.

library(data.table)
re_d <-
  structure(
    list(
      rn = c("any_of(fn1)", "any_of(fn2)", "main_folder", "stata_file",
        "text?", "text?", "text?"),
      re = c(NA, NA, NA, NA, "[^/]+?", "[^/]+?", "[^/]+?")
    ),
    .Names = c("rn", "re"),
    class = c("data.table", "data.frame"),
    row.names = c(NA, -7L),
    sorted = "rn"
  )
pf <- function(x) {
  print(x)
  utils::flush.console()
  return(invisible(x))
}
obj_n <- c("excel_file", "fn1", "fn2", "main_folder", "scan_path", "spss_file",  "stata_file", "x")

# This works fine
re_d[, pf(rn)]
# This works fine
re_d[J(obj_n), rn,  by = .EACHI, nomatch = 0]
# This bring the pain train. 
re_d[J(obj_n), pf(rn),  by = .EACHI, nomatch = 0]

Before Rstudio disintegrates all I see is:

[1]
 
 

My session info:

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.9.8
loaded via a namespace (and not attached):
[1] tools_3.3.2

@mattdowle

This comment has been minimized.

Copy link
Member

@mattdowle mattdowle commented Nov 28, 2016

Thank you! Looking ...

@mattdowle mattdowle modified the milestones: v1.9.10, v1.9.12 Nov 28, 2016
@mattdowle

This comment has been minimized.

Copy link
Member

@mattdowle mattdowle commented Nov 29, 2016

Interestingly, this crashes with old v1.9.6 as well.

@ProfFancyPants

This comment has been minimized.

Copy link
Author

@ProfFancyPants ProfFancyPants commented Nov 29, 2016

Exactly. After I posted, I tested it on v1.9.6 and on a mid-ish v1.9.7 build from last year -- all crash. I am glad I was able to isolate this issue. I think I have seen it before a while a few years ago. Can I just say that you and Arun are my heroes, and about 95% of the reason I am even in this field. If I didn't have data.table, I wouldn't have gotten into R. So if you guys need any help at all just tell me. O, and my example might sound like a strange use case, but it is actually quite practical. It is only one line of code, but it is extremely powerful.

@mattdowle

This comment has been minimized.

Copy link
Member

@mattdowle mattdowle commented Nov 30, 2016

Thanks for the encouragement! And the great example. Found and fixed.

@mattdowle mattdowle closed this in 5f9aec7 Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.