Open michaelpawlus opened 6 years ago
Thanks @michaelpawlus, I'll have a look into that :)
This seems to be somewhat related to #9. There seems to be issues in the current versions of the functions as they are too strict and are not able to deal with empty results.
unnest_*
functions should check for empty elements and return a NA or NULL when there is nothing to return, instead of throwing an error / warning as they do now.
I notice when I use the Norwegian band dataset where the relationships have no attributes then unnest_relationships works perfectly.
However, when I test it with some of the movie data I run into one of the two following errors:
If there is just one attribute:
Error: Can't coerce element 1 from a list to a character
If there are more than one:
Error: Result 1 is not a length 1 atomic vector
I find just changing from map_chr to map seems to resolve the issue:
With the Norwegian band data it will still produce NAs however if there is a data set where some edges have attributes and others do not then it just shows NULL see example below:
Unfortunately, I am not finding a way to retain the NAs in these cases.