Separate or join variables over/from 2 columns - tidyr::separate() / unite()

PHOTO EMBED

Thu Jun 02 2022 06:02:35 GMT+0000 (Coordinated Universal Time)

Saved by @Treenose #r #tidyr

#########Separate############

df %>% 
  separate(column_w_2_obs, into = c("obs1", "obs2"), sep = ",") 
### use "convert = TRUE" after sep arg to convert separeted columns into numeric if applicable.

#########Unite############
df %>%
  unite(united_col, col1, col2, sep = " ") #Sep = " " makes white space



content_copyCOPY