Re: [R] Decompose df1 into another df2 based on values in df1

2021-05-27 Thread Eik Vettorazzi
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=

Re: [R] Decompose df1 into another df2 based on values in df1

2021-05-26 Thread Bert Gunter
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