Hello R users,
The code below is for loop in R that I want to do to following
calculation at each time i and i-1 in 2:75 dataset
(Litterfall_Ahmed97).
ac = ((LeafBiog at date i
-LeafBiog at date i-1, dataset = leafbiom97) + (littperiod at date i,
dataset= Litterfall_Ahmed97))/(sum (GPP from date i-1 to date i,
dataset=GPP_Ahmed13)/2) .
#code for loop
GPP_Ahmed13$Date <- as.Date(GPP_Ahmed13$Date, '%Y/%m/%d')
Litterfall_Ahmed97$Date <- as.Date(Litterfall_Ahmed97$Date, '%Y/%m/%d')
leafbiom97$Date <- as.Date( leafbiom97$Date, '%Y/%m/%d')
for (i in 2:75){
(leafbiom97$LeafBiog[leafbiom97$Date == "i"] -
leafbiom97$LeafBiog[leafbiom97$Date == "i-1"]+
Litterfall_Ahmed97$littperiod[Litterfall_Ahmed97$Date =="i"])/
(sum(GPP_Ahmed13$GPP[GPP_Ahmed13$Date >= "i-1" &
GPP_Ahmed13$Date <= "i"])/2)
}
#Error in charToDate(x) :
Thanks for your help
Ahmed Attia, Ph.D.
Agronomist & Soil Scientist
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.