A tidyverse-ish solution would be
library(dplyr)
library(tidyr)
library(tibble)
# max cols to split values into
seps<-max(stringr::str_count(unlist(d1),"[/|]"))+1
d1 %>% pivot_longer(S1:S5, names_to="S") %>%
mutate(value=na_if(value,"w")) %>% separate(value,"[/|]",
into=LETTERS[1:seps], fill=
Thank you for the reprex. However your specification was too vague for me
to know exactly what your data are like, so I tried to assume the most
general possibility, with the consequence that I may be giving you an
answer to the wrong question. Hopefully, you can adjust as needed to get
what you wa
2 matches
Mail list logo