Using the following commands (x is a table with 3 columns A, B and C)
library(reshape)
cast(x, A~B)
Following error appears:
Using C as value column. Use the value argument to cast to override this choice
Error in order(A = list("xxx", :
unimplemented type 'list' in 'listgreater'
What does it means and how to solve it?
I guess it maybe due to the dataframe's data format (correct me if I am wrong). As i did a test of the format of the table x and y with str command.
str(x) returns
$ A: List of 6
..$ : chr "xxx"
....
$ B:chr "yyy" "yy2" ....
...
$ C: List of 6
..$ : num 22.....
...
For another table y with column D E and F, no error message appears when I run the cast command.
str(y) shows that all D E F columns are Factor w/ 6 levels....
How can I make cast work for list and num containing dataframe x?
use
df <- as.data.frame(lapply(df, unlist))
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