Suppose I have the following dataframe:
| a | b | c |
x | 1 | 2 | 3 |
y | 4 | 5 | 6 |
z | 7 | 8 | 9 |
I would like to convert it into a list by row, with each containing a named vector, which is basically the equivalent of the output of list(x=c(a=1,b=2,c=3), y=c(a=4,b=5,c=6), x=c(a=7,b=8,c=9))
:
$x
a b c
1 2 3
$y
a b c
4 5 6
$x
a b c
7 8 9
How would I go about doing this?