R/moult_color.R

Defines functions moult_color

Documented in moult_color

#Rmolt for molt graph
#set the color in function of the percentage value
#' moult_color
#' @title moult_color
#' @name moult_color
#' @param i a value to run the loop
#' @param data a data table to choose the color
#' @return color of the feather depending of the percentage, called for side effect
#' @export

globalVariables(c("Rmolt_env","feather"))
moult_color <- function(i,data){


  if(data[i,2]==0){
    feather = "white"
  }

  if (data[i,2]>=0.00001 & data[i,2]<=0.05){
    feather = "gray90"
    }
  if (data[i,2]>=0.0500001 & data[i,2]<=0.10){
  feather = "gray80"
    }
  if (data[i,2]>=0.100001 & data[i,2]<=0.25){
    feather = "lightyellow3"
  }
  if (data[i,2]>=0.251 & data[i,2]<=0.50){
    feather = "gray57"
    }
  if (data[i,2]>=0.5000001 & data[i,2]<=0.75){
    feather = "gray37"
    }
  if (data[i,2]>=0.7500001 & data[i,2]<=0.90){
    feather = "gray20"
    }
  if (data[i,2]>=0.9000001){
    feather = "gray0"
   }

  feather <- feather

}

Try the Rmolt package in your browser

Any scripts or data that you put into this service are public.

Rmolt documentation built on Sept. 22, 2022, 9:06 a.m.