R/print_ltx.R

#' Codes exclus
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_exclu <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " ")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}


#' CVS
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_drgCVS <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " "),
          align = c("r","l","r","r","l","r","r","r","r","r"),
          col.names = linebreak(c("Code",
                                  "Dénomination",
                                  "\\textit{CVS}",
                                  "\\textit{cv}\n(\\%)",
                                  "Préc$^{\\dagger}$",
                                  paste0("$\\bar{T}$\n(/",nbr.pers,")"),
                                  paste0("$T_{Std~dir}$$^{\\ddagger}$\n(/",nbr.pers,")"),
                                  "QP90/10",
                                  "$N_{Obs}$",
                                  "N"),
                                align = "c")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "") %>%
      column_spec(2, width = "10.5em")
    )
}

#' Gains Outliers
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_outliers <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " "),
          col.names = linebreak(names(x), align = "c"),
          align = c("r", rep("r", length(cvs)))) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}

#' Gains pourcentage
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_p100 <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " "),
          align = "r",
          col.names = linebreak(names(x), align = "c")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}

#' Gains percentiles
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_pctl <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " "),
          align = "r",
          col.names = linebreak(names(x), align = "c")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}

#' Avertissement régions pas affichées
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_warn <- function(x) {
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " "),
          col.names = c(region, "$\\hat{\\theta}_{j}$")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "",
                    font_size = 6)
  )
}

#' Résultats par zone géographique
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_resultzone <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          format.args = list(decimal.mark = ",", big.mark = " "),
          align = c("l", "r", "r", "r", "r", "r", rep("l", length(cvs))),
          col.names = linebreak(names(x), align = "c")) %>%
      kable_styling(latex_options = c("striped", "HOLD_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}

#' Gains par zones géographiques
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_gainzones <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          align = c("l", rep("r", ncol(x)-1)),
          format.args = list(decimal.mark = ",", big.mark = " "),
          col.names = linebreak(names(x), align = "c")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}

#' Gains par zone - pourcentages
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_gainzones_p100 <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          align = c("l", rep("r", ncol(x)-1)),
          format.args = list(decimal.mark = ",", big.mark = " "),
          col.names = linebreak(names(x), align = "c")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}

#' Gains par zone - percentiles
#'
#' @param x Tableau à afficher
#'
#' @keywords internal
#' @export
print_gainzones_pctl <- function(x){
  x <- as.data.frame(x)
  print(
    kable(x, "latex", longtable = T, booktabs = T, escape = F, row.names = F, linesep = "",
          align = c("l", rep("r", ncol(x)-1)),
          format.args = list(decimal.mark = ",", big.mark = ""),
          col.names = linebreak(names(x), align = "c")) %>%
      kable_styling(latex_options = c("striped", "hold_position", "repeat_header"),
                    position = "center",
                    repeat_header_text = "")
  )
}
INESSSQC/variation documentation built on July 3, 2019, 11:33 a.m.