R: Error Message of cast "unimplemented type 'list' in 'listgreater"
11,242
use
df <- as.data.frame(lapply(df, unlist))
Author by
Sally
Updated on June 05, 2022Comments
-
Sally almost 2 years
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?