I am trying to access a column in a data frame using a variable , this variable wil be populated in a loop
atr<-"yield_kgha"
so what i want is the second line below where $atr
to act like it was $yield_kgha
I tried $get(atr)
with no luck ... how do I get atr to be taken literally
meanis=MEAN = mean(zones[[zonename]]$yield_kgha , na.rm = TRUE) #get the mean yield_kgha in the zone
meanis=MEAN = mean(zones[[zonename]]$atr , na.rm = TRUE) #get the mean yield_kgha in the zone