My question is so trivial, I want to paste a vector in a loop like this
Mysheetlandscap <- excel_sheets("C:/FAPSEP_Eucalyptus/FAPSEP/AHMED_GDAY/CloneParnew5_forCALIB2.xlsx")
for(j in 1:length(Mysheetlandscap)){
ClonePar <- read_excel("C:/FAPSEP_Eucalyptus/FAPSEP/AHMED_GDAY/CloneParnew5_forCALIB2.xlsx", sheet = Mysheetlandscap[j])
x <- ClonePar$,j,[!is.na(ClonePar$MIN_CL)] #should return the vector ClonePar$j
}
So I tried
get(paste0("ClonePar$",j))
Error in get(paste0("ClonePar$", j)) : object 'Cal_OCT_18_GLM$C041H' not found
What I'm missing?
ClonePar[[3]].$,j,When looping you typically need to fill an empty listx <- list()and then have the looping index specified when you fill it with a loopClonePar[j] <- read_excel("C:/FAPSEP_Eucalyptus/FAPSEP/AHMED_GDAY/CloneParnew5_forCALIB2.xlsx", sheet = Mysheetlandscap[j])Also isxoutside of your loop, it isn't clear since you don't have a terminal}ClonePar <- list()outside the loop. Then, inside the loop usejto assign values:ClonePar[[j]] <- whatever.