I have a dataframe like the following one :
dom_output <- data.frame(
Site = c("alpha", "beta", "charlie", "delta","alpha", "beta", "charlie", "delta"),
Value = c(11,22,33,44,55,66,77,88),
label = c("Watermelon","Vanilla","Default","Default","Watermelon","Vanilla","Default","Default")
)
I want to split it different data frames based on Site
. So the new data frame names should be based of the Site
. I know how to filter and select it but how do I do it in a loop and name the df based on the split value itself.
So I would have 4 df alpha
,beta
,charlie
, delta
.