I have the following data frame, Test_for_loop.csv
I want to separate the data frame based on the column "mycoreLabel". So, i used the function list2env() and it worked properly. Now for each dataframe i want to get the mean of column 'splineBD'. I want ot use for loop. But when I using the following script it's giving me the following error,
"Error: $ operator is invalid for atomic vectors"
This is the code i have used,
list2env(split(Core_strata_OC, Core_strata_OC$mycoreLabel), envir = .GlobalEnv)
OCi<- c()
for (i in 1:3){
OCi[i]<- mean(`i`$splineBD)
OCi
}
OCi<-as.data.frame(OCi)