#' Area under the disease progress curve (AACPD)
#'
#' AACPD
#' @description The aacpd function calculates the area under the disease progress curve according to the methodology proposed by Campbell & Madden, 1990
#' @param dados Data.frame composed of the evaluation in each time in columns.
#' @param tempo Vector numeric with time
#' @param trat Vector with the names of the treatments with the repetitions
#' @keywords AACPD
#' @keywords Index
#' @references Campbell CL, Madden LV (1990) Introduction to plant disease epidemiology. New York NY. John Wiley & Sons.
#' @import xlsx
#' @export
#' @examples
#' dia7=c(0,2,1, 4,5,6, 2,3,2)
#' dia14=c(4,5,6, 8,9,8, 14,15,16)
#' dia21=c(14,20,16, 25,26,28, 30,31,33)
#' dia28=c(30,35,32, 40,41,44, 46,48,50)
#' dia35=c(45,47,50, 48,49,50, 50,50,49)
#' dados=data.frame(dia7,dia14,dia21,dia28,dia35)
#' trat=rep(c("T1","T2","T3"),e=3)
#' tempo=c(7,14,21,28,35)
#' aacpd(dados,tempo,trat)
aacpd = function(dados, tempo, trat,save=FALSE) {
d=dados
t=tempo
ndata=length(tempo)
i=ndata
aacpd=tapply(rowSums(data.frame((d[,1]+d[,2])/2*(t[2]-t[1]),
(d[,3:i]+d[,3:i-1])/2*
(t[3:i]-t[2:(i-1)])[1])),seq(1:length(d[, 1])),sum,na.rm = T)
pive = data.frame(trat, aacpd = aacpd)
print(pive)
library(xlsx)
if(save==TRUE){xlsx::write.xlsx(pive, "Planilha.xlsx")}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.