We could use c_across with rowwise from dplyr

library(dplyr)
df %>%
    rowwise %>%
    transmute(label, data = list(c_across(a:c))) %>%
    ungroup

-output

# A tibble: 4 x 2
#  label data     
#  <chr> <list>   
#1 ger   <dbl [3]>
#2 at    <dbl [3]>
#3 uk    <dbl [3]>
#4 us    <dbl [3]>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top