#' Creates the color combinations for the absence, presence, gain, and loss
#'
#' @param rasterTrajectories2 The first data frame from the catTrajectory function
#'
#' @importFrom raster, raster
#'
#' forcats
#'
#' @export
#'
#'
#' @return A data frame containing the IDs, components and colors
colorMatch <- function(rasterTrajectories2) {
ID <- c(0,1,2,3,4)
myColv1 <- c("White","#c4c3c0","#666666","#000080","#8b0000")
trajetoryCalss_v1 <- c("Mask","Absence","Presence","Gain","Loss")
idColorTrajectory <- data.frame(ID,myColv1,trajetoryCalss_v1)
factRasterTrajectories <- ratify(rasterTrajectories2)
factRasterTrajectories2 <- factRasterTrajectories
factRasterTrajectories2 <- levels(factRasterTrajectories2)[[1]]
factRasterTrajectories3 <- left_join(factRasterTrajectories2,idColorTrajectory , by = c("ID" = "ID"))
return(factRasterTrajectories3)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.