I have datasets formatted in a way represented by the set below:
FirstName Letter
Alexsmith A1
ThegreatAlex A6
AlexBobJones1 A7
Bobsmiles222 A1
Christopher A9
Christofer A6
I want to change it to this:
School FirstName Letter
Greenfield Alexsmith A1
Greenfield ThegreatAlex A6
Greenfield AlexBobJones1 A7
Greenfield Bobsmiles222 A1
Greenfield Christopher A9
Greenfield Christofer A6
I want to add a leftmost column indicated which school the dataset comes from. I am importing this data from csv into R to begin with, and the filenames already have the school name in them.
Is it possible to retrieve the school name from the file name? The filenames are formatted like this: SCHOOLNAME_1, SCHOOLNAME_2, etc. The numbers do not need to be retained
My goal here is to automate this process through a loop because of how many of these datasets I will be accumulating, which is why I am starting small with this question.
I tried something like this:
School <- c(length(schoolimport))
but don't know how to add in the values of each cell
Thank you & I am happy to clarify anything