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

Separate_rows in v1.1.1 doesn't seem to work the same as in v1.1.0 #1014

Closed
alexeyza opened this issue Aug 1, 2020 · 0 comments · Fixed by #1023
Closed

Separate_rows in v1.1.1 doesn't seem to work the same as in v1.1.0 #1014

alexeyza opened this issue Aug 1, 2020 · 0 comments · Fixed by #1023

Comments

@alexeyza
Copy link

alexeyza commented Aug 1, 2020

There are inconsistencies in how separate_rows works in version 1.1.1 compared to version 1.1.0. I noticed it when my code that was working in 1.1.0 was now returning errors due to empty data.frames and other errors (in 1.1.1).

# reprex (version 1.1.0)

> iris %>% separate_rows(Species, sep = ";")
# A tibble: 150 x 5
   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
          <dbl>       <dbl>        <dbl>       <dbl> <chr>  
 1          5.1         3.5          1.4         0.2 setosa 
 2          4.9         3            1.4         0.2 setosa 
 3          4.7         3.2          1.3         0.2 setosa 
 4          4.6         3.1          1.5         0.2 setosa 
 5          5           3.6          1.4         0.2 setosa 
 6          5.4         3.9          1.7         0.4 setosa 
 7          4.6         3.4          1.4         0.3 setosa 
 8          5           3.4          1.5         0.2 setosa 
 9          4.4         2.9          1.4         0.2 setosa 
10          4.9         3.1          1.5         0.1 setosa 
# … with 140 more rows
# reprex (version 1.1.1)

> iris %>% separate_rows(Species, sep = ";")
Error in .f(.x[[i]], ...) : non-character argument

Also, try both versions on a dataframe with a column of empty strings in it:

iris %>% mutate(test = "") %>% separate_rows(test, sep = ";")

In version 1.1.0 it returns the full original dataframe, while in version 1.1.1 it returns an empty dataframe.


From a quick glimpse on recent changes, I think it comes down to the following change:
f0bcfd9#diff-46dad93d5ee31264d672c8ed8c984258

I tried to see what could be the source for the difference by looking at:

> stringi::stri_split_regex(str="", pattern = ";")
[[1]]
[1] ""

> strsplit("", split = ";", perl = T)
[[1]]
character(0)
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

Successfully merging a pull request may close this issue.

1 participant