t1 <- tribble(~a, ~b, 1, 2, 3, 4)
t1
A tibble: 2 × 2 a b <dbl> <dbl> 1 1 2 2 3 4
How to transform each line to a list, without the variable name a or b, one line a new variable name:
list of 2: $list line_name1 [1,2] $list line_name2 [3,4]
Thanks,
One method:
> as.list(as.data.frame(t(t1))) $V1 [1] 1 2 $V2 [1] 3 4
thanks to your hint, tidy way works too:
as.list (as_tibble(transpose(t1)))
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.