I am having some trouble trying to create a new data frame for each unique value in one of my columns in my data frame.
For example, I have a data frame set up similar to this:
df1 <- data.frame(Fruit = c("Apples", "Apples", "Apples", "Oranges", "Oranges", "Bananas", "Bananas"),
No. = c(2,8,7,1,4,9,6))
How can I create a new dataframe for each unique value AND name the data frame after the unique value?
I know that I can use subset like this:
Apples <- subset(df1, df1$Fruit == "Apples")
Oranges <- subset(df1, df1$Fruit == "Oranges")
Bananas <- subset(df1, df1$Fruit == "Bananas")
But I have over 100 unique values in my column in my data frame.