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

Throw error on spread_all in case of name conflict #76

Open
jeremystan opened this issue Sep 7, 2016 · 1 comment
Open

Throw error on spread_all in case of name conflict #76

jeremystan opened this issue Sep 7, 2016 · 1 comment

Comments

@jeremystan
Copy link
Collaborator

If spread_all generates a name that already exists in the data frame, then throw a meaningful error about the name conflict.

@colearendt
Copy link
Owner

Not sure whether the focus here is to throw a more meaningful error when the dedup fails or to remove the deduplication behavior altogether (it can make exploring nice, but it can also be hard to tell where a value comes from). I made a change supporting the former in 291cf53. Naming is not necessarily nice... as each iteration will append a new series of ".#".

Would like to get feedback on whether the API should be deduping or not. If so, perhaps the method of doing so could be cleaned up somehow.

'{"a.b": 1, "a": {"b.2": 2, "b":3}}' %>% spread_all()
#> Warning in spread_all(.): results in duplicate column names, appending .#
#> for uniqueness

#> Warning in spread_all(.): results in duplicate column names, appending .#
#> for uniqueness
#> # A tbl_json: 1 x 4 tibble with a "JSON" attribute
#>           `attr(., "JSON")` document.id   a.b a.b.2 a.b.2.2
#>                       <chr>       <int> <dbl> <dbl>   <dbl>
#> 1 "{\"a.b\":1,\"a\":{\"..."           1     1     2       3

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