I have a vector where there is a need to convert to dataframe. Is there a way to achieve this?
asd <- c("ABC\tCat + Catt1") Expected output
df ColA ColB ABC Cat ABC Catt1 library(tidyverse) asd <- c("ABC\tCat + Catt1") asd %>% str_replace_all(regex("\\W+"), " ") %>% as_tibble() %>% separate(value, into = c("ColA", "A", "B"), sep = " ") %>% pivot_longer(-ColA, values_to = "ColB") %>% select(-name) # A tibble: 2 × 2 ColA ColB <chr> <chr> 1 ABC Cat 2 ABC Catt1