I’d like to use the much-praised idata.frame() function to speed up some large plyr functions, but it’s not returning an immutable data frame in the form that I’m expecting.
All the examples I’ve seen suggest that I can just assign idata.frame(baseball) to a new variable and start working with it, but I’m getting unexpected results from the function:
> ibb <- idata.frame(baseball)
> str(ibb)
Classes 'idf', 'environment' <environment: 0x0d0f15d8>
> ibb
<environment: 0x0d0f15d8>
attr(,"class")
[1] "idf" "environment"
Thanks for any tips. I’m using R version 2.14.1 with plyr 1.7.1.
EDIT: in the example above, it’s possible to run ddply(idata.frame(ibb), .(year), "nrow") successfully, so the immutable object is working as expected in that regard. I’m wondering why certain data.frame behavior isn’t available, and if there’s any documentation as to the difference.
I wouldn’t expect much beyond the plyr functions that Hadley wrote to handle
idata.frameto work. I don’t think Hadley wrote methods for anything beyond his own plyr functions, and even then his own documentation states that it is experimental.If you want a more complete integration with
data.frame, Matthew Dowle is right, use data.table.