I'm looking for a way to split up a large Excel file into a number of smaller Excel files using R.
Specifically, there are three things I would like to do:
- I have a large data set consisting of information regarding students (their school, the area in which the school is located, test score A, test score B) that I would like to split up into individual files, one file per school containing all of the students attending that specific school.
- I would also like all of the individual Excel files to contain an image covering the first row and columns A, B, C & D of every Excel file. The image will be the same for all the schools in the data set.
- Lastly, I would also like the Excel files, after being created, to end up in individual folders on my desktop. The folders name would be the area in which the schools are located. An area has about 3-5 schools so the folder would contain 3-5 Excel files, 1 for each school.
My data is structured like this:
Area | School | Student ID | Test score A | Test score B |
---|---|---|---|---|
North | A | 134 | 24 | 31 |
North | A | 221 | 26 | 33 |
South | B | 122 | 22 | 21 |
South | B | 126 | 25 | 25 |
I have data covering roughly 200 schools located in 5 different areas.
Any guidance on how to do this would be greatly appreciated!
paste
command. you could just use simple loops if the files is not too big. I dont understand what you mean in 2. with the image.