for(i in unique(IsraelData_QTR1$year)) {
nam <- paste("IsraelData_QTR1", i, sep = ".")
assign(nam, IsraelData_QTR1[IsraelData_QTR1$year==i,])
}
I would like to use the mean function to calculate the mean of a column something like this, using a loop to create several means with changing variable name:
Mean_QTR1.81 <- mean(IsraelData_QTR1.81$DailyHoursWorked)
Mean_QTR1.82 <- mean(IsraelData_QTR1.82$DailyHoursWorked)
The 81 is because the loop goes between 81 and 91 for the names of each new dataframe.
Another problem I thought about is that I would need to do something to change the name of the variable each time depending on the name of the new dataframe. Is there any way to do this ?
Any help is appreciated