Hello,
I would like your help.
How could I create a column using as_tibble
function and assigning a name to the column? Below the code using as.data.frame
and col.names
with the expected result.
library(tidyverse)
df <- tribble(~concat,
"S:AMP,R:AUG,R:CFZ,S:CFZ , R:TMP")
df %>%
str_squish() %>%
str_replace_all(" ","") %>%
str_split(",") %>%
as.data.frame(col.names = "concat") %>% #here I'm trying to use as_tibble
separate_wider_delim(
cols = "concat",
delim = ":",
names = c("type","product"))