I'm programming a box model with n layers. I want to generate a data frame for each layer I define in my box model and perform calculations in each column of each data frame. I've initialized the data frames using this code:
##Initialize layer energy+water balance dataframes
calcs <- c("Vwin", "Vwout", "Vsin","Vsout","Pistd","Vwnet","Psin","Psout","Vw","Vemax","Sw","Cp","Kt","Qwout","Qtop","Qbot","Qsides","Qnet","Tavg")
layer_tabs<-list()
for(i in 2:(layers-1)){
nam <- paste("layer_",i,sep = "")
assign(nam,data.frame(matrix(vector(),t,length(calcs),dimnames = list(c(),calcs))))
append(layer_tabs, nam=nam)
}
Now for each column named in my calcs vector I need to perform a specific calculation in each layer data frame. I want to either append the layer data frames as they are generated to a list that I can loop through or use an apply function on and then write functions/equations for each column OR loop through the data frames by using the number in their variable name. My attempt to append the data frames as they were generated to the empty list "layer_tabs" returned the error:
Error in append(layer_tabs, nam = nam) : unused argument (nam = nam)