I have a large dataframe I would like to split into multiple small data frames, based on the value in the Name
column.
head(DATAFILE)
# Age Site Name 1 2 3 4 5
# 10 1 Orange 0 2 1 0 1
# 10 1 Apple 2 5 4 0 2
# 10 1 Banana 0 0 0 0 2
# 20 2 Orange 0 2 1 0 0
# 20 2 Apple 0 2 0 7 1
# 20 2 Banana 0 4 1 3 6
And an example file of the desired output;
head(Orange)
# Age Site Name 1 2 3 4 5
# 10 1 Orange 0 2 1 0 1
# 20 2 Orange 0 2 1 0 0
I have tried
SPLIT.DATA <- split(DATAFILE, DATAFILE$Name, drop = FALSE)
But this returns a large list, and I would like individual files so that I can save them as .csv files. So I would like either a better way of dividing the original file, or a way to further divide the SPLIT.DATA file.