Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Inconsistent behaviour in melt.list() with multi-level lists: #25

Closed
naught101 opened this Issue · 1 comment

2 participants

@naught101
R> melt(list(blah=c(1,230,123), a=list(c="b", d="f")))
  value   L1   L2
1     1 blah <NA>
2   230 blah <NA>
3   123 blah <NA>
4     1    a    c
5     2    a    d
R> melt(list(blah=c(1,230,123,'s'), a=list(c="b", d="f")))
  value   L1   L2
1     1 blah <NA>
2   230 blah <NA> 
3   123 blah <NA>
4     s blah <NA>
5     b    a    c
6     f    a    d

In the first, the "value" is numeric, in the second, it's "factor". I'm guessing it just sticks with what ever format the first list ends up with when it's converted to a data frame? This probably isn't a major problem, cause no-one in their right mind is going to be using melt with lists like this, but I noticed it, and thought it might be relevant in cases I hadn't thought of.

@hadley
Owner

That's because I'm using plyr::rbind.fill() - I'm not sure if it's always possible to be consistent in the face of the many types of input you could provide.

@hadley hadley closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.