R/fcolor_function.R

Defines functions fcolor

Documented in fcolor

#' Color parameters (hue angle, Chroma, CIRG)
#'
#' Colors
#' @param a Numeric vector with parameter a
#' @param b Numeric vector with parameter b
#' @param L Numeric vector with parameter L
#' @param CIRG Index used for red grapes (TRUE to calculate)
#' @param trat Vector with the names of the treatments with the repetitions
#' @author Gabriel Danilo Shimizu
#' @import xlsx
#' @keywords a
#' @keywords b
#' @keywords L
#' @keywords hue
#' @keywords chroma
#' @keywords CIRG
#' @keywords Indices
#' @export
#' @examples
#' L=c(47.1,45.7,45.5,45.8)
#' a=c(31.4,30.8,31.7,32)
#' b=c(30.7,28.2,27.5,27.3)
#' fcolor(a,b,L)

fcolor = function(a, b, L,CIRG=F,save=FALSE){
  hue=atan(b/a)/pi*180
  chroma=sqrt(a^2+b^2)
  L=L
  if(CIRG==T) {CIRG = (180-hue)/(L+chroma)}else{CIRG=NA}
  data=data.frame(trat,a,b,L,hue,chroma,CIRG)
  print(data)
  if(save==TRUE){xlsx::write.xlsx(data, "Planilha.xlsx")}}
AgronomiaR/iagro documentation built on April 16, 2020, 10:54 p.m.