Displaying 1 result from an estimated 1 matches for "x_level_of_a".
2011 Aug 10
3
How to quickly convert a data.frame into a structure of lists
...a structure of list where I have a list for every
level of A, those list all contain lists for every levels of B, and the
'b-lists' contains all the values of C that match the corresponding levels
of A and B.
So, I should be able to write something like this:
> MyData at list_structure$x_level_of_A$y_level_of_B
and get a vector of the values of C that were on rows where A=x_level_of_A
and B=y_level_of_B.
My first attempt was to use two imbricated "lapply" functions running
something like this:
list_structure<-lapply(levels(A) function(x) {
as.character(x) = lapply( levels(B),...