I have a dataframe with a column named CHR which has discrete values from 1 to 18 (1, 2, 3 ...)
I want to subset the dataframes for each value of CHR. So far my code (working) looks like this:
CH1<-boxplot %>% filter(CHR == "1")
CH2<-boxplot %>% filter(CHR == "2")
CH3<-boxplot %>% filter(CHR == "3")
.
.
.
CH18<-boxplot %>% filter(CHR == "18")
It does get the job done, but I'm very annoyed whenever my code looks like that. I want to learn one "proper" way so I can apply it to multiple other similar cases.