The docs for rdply
in the plyr
package say this about the .id
argument:
.id: name of the index column. Pass ‘NULL’ to avoid creation of
the index column. For compatibility, omit this argument or
pass ‘NA’ to avoid converting the index column to a factor;
in this case, ‘".n"’ is used as colum name..
Unfortunately the described behavior does not seem to work when I pass NULL. Consider:
>rdply(20, mean(runif(20)))
.n V1
1 1 0.4202275122
2 2 0.5140590765
3 3 0.4201277295
4 4 0.4082553896
...
Now, I try to get rid of the index column:
> rdply(20, mean(runif(20)),.id=NULL)
Error in if (!is.na(.id)) names(labels) <- .id :
argument is of length zero
In addition: Warning message:
In is.na(.id) : is.na() applied to non-(list or vector) of type 'NULL'
Question: How do I use the .id argument to avoid creation of the index column, as described in the documentation?
Wait until this will be fixed or use name of existing column as .id
:
> rdply(20, mean(runif(20)), .id="V1")
V1
1 0.4804
2 0.6339
3 0.5460
4 0.4473
5 0.4639
6 0.4759
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With