R/ic_function.R

Defines functions ic

Documented in ic

#' Harvest Index
#'
#' ic
#' @description The function calculates the grain harvest index according to the methodology of Pereira and Machado (1987) or index harvest usual to the methodology of Cost, Shibata and Colin (1985)
#' @param MSPA Numeric vector with dry shoot weight
#' @param MSG Numeric vector with dry mass of grains
#' @param MSF Numeric vector with dry leaf mass (default is FALSE)
#' @param trat Vector with the names of the treatments with the repetitions
#' @keywords IC
#' @keywords Indices
#' @references PEREIRA, A.R., MACHADO, E.C. Analise quantitativa do crescimento de comunidades vegetais. Campinas: Instituto Agronomico, 1987. 33 p. (Boletim Técnico, 114).
#' @references COSTA, J.G.C.; SHIBATA, J.K.; COLIN, S.M. Indice de colheita em feijoeiro comum. Pesquisa Agropecuaria Brasileira, v. 20, n. 6, p. 737-739, 1985.
#' @author Gabriel Danilo Shimizu
#' @import xlsx
#' @export
#' @examples
#' MSPA=rnorm(100,10,1)
#' MSG=rnorm(100,10,1)
#' MSF=rnorm(100,10,1)
#' trat=rep(c("T1","T2","T3","T4"),e=25)
#' iqd(MSPA,MSG,MSF,trat,save=T)


ic = function(MSPA, MSG, MSF=NULL,trat,save=FALSE){
  if(MSF==NULL){ic=MSG/MSPA*100}else{ic=MSG/(MSPA-MSF)*100}
  dados = data.frame(trat, MSPA,MSG,MSF,ic)
  print(dados)
  if(save==TRUE){xlsx::write.xlsx(dados, "Planilha IC.xlsx")}
}
AgronomiaR/iagro documentation built on April 16, 2020, 10:54 p.m.