Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: Error Message of cast "unimplemented type 'list' in 'listgreater"

Tags:

casting

r

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?

like image 332
Sally Avatar asked Oct 15 '25 14:10

Sally


1 Answers

use

df <- as.data.frame(lapply(df, unlist))
like image 110
Ohad Zadok Avatar answered Oct 18 '25 07:10

Ohad Zadok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!