R/valueBoxString.R

#' valueBoxValues
#'
#' @description Calculate color and string needed in the ShinyApp valueBoxOutput based on a turfeffect model output
#'
#' @param model An object of class lm, generated by the turfeffect function
#' @param type A string
#'
#' @return x, a list with the first element (x$x) containing the string of slope and p value, and a second element (x$color) containing the color that the valueBox should have
#'
#' @export
#'


valueBoxString <- function(model, type = NULL) {

  est = model$estimate
  p = model$p

  x <- paste("Efecto = ", formatC(est, digits = 2, format = "f"), "; p = ", formatC(p, digits = 2, format = "f")
  )

  return(x)
}
turf-reserves/MPAtools documentation built on June 1, 2019, 2:54 a.m.