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

Regex "dot" crashing Rstudio with separate #50

Closed
JakeRuss opened this issue Dec 24, 2014 · 2 comments
Closed

Regex "dot" crashing Rstudio with separate #50

JakeRuss opened this issue Dec 24, 2014 · 2 comments

Comments

@JakeRuss
Copy link
Contributor

@JakeRuss JakeRuss commented Dec 24, 2014

I caused an issue with separate yesterday. While tidying, I gathered a series of columns into a single column that looks like this,

df <- data.frame(yrqtr = rep("X1996.04", times = 1000000))

My desire is to separate this column by "." but the following was causing RStudio to hang and then crash,

df <- separate(df, col = yrqtr, into = c("year", "quarter"), sep = ".")

After some investigation I realized my mistake by remembering that "dot" means match everything in regular expressions. So I'm breaking separate by supplying it the worst possible regex. Changing that line to sep = "\\." eliminates the problem.

I imagine that other people will run into this issue also by following their intuitions for the separator argument. Had the column been "X1996@04", sep = "@" would have worked, and in the manner I initially expected would work with "."

Is sep = "." a pain point worth throwing a warning about?

Interestingly, sep = "." + extra = "merge" also "solves" the crashing, but it's doing so in a way that obscures the error of my improper regex string.

@hadley
Copy link
Member

@hadley hadley commented May 19, 2015

Hmmmmm, the seg fault comes from stop()

Loading

@hadley hadley closed this in 0cdc67a May 19, 2015
@hadley
Copy link
Member

@hadley hadley commented May 19, 2015

Couldn't figure out a minimal reproducible example for the segfault, but this fixes the problem by not creating an incredibly long error string.

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants