Answers for "how to split new data frame in r from columns of intrest"

R
2

how to split a column in r

library(tidyverse)
df <- df %>% separate(old_col_name, c('new_col_1','new_col_2'), extra='drop')
Posted by: Guest on April-08-2021
0

R split dataframe per column

data_list <- split(data, f = data$id)                     # Split data
data_list                                                 # Print list
# $A
# id x1 x2
# 1  A  1 11
# 2  A  2 12
# 
# $B
# id x1 x2
# 3  B  3 13
# 4  B  4 14
# 5  B  5 15
# 
# $C
# id x1 x2
# 6  C  6 16
Posted by: Guest on January-22-2022

Code answers related to "how to split new data frame in r from columns of intrest"

Browse Popular Code Answers by Language