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

JakeRuss opened this issue Dec 24, 2014 · 2 comments


Copy link

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.


This comment has been minimized.

Copy link

commented May 19, 2015

Hmmmmm, the seg fault comes from stop()

@hadley hadley closed this in 0cdc67a May 19, 2015


This comment has been minimized.

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.