Insert latex colors into a matrix
Arguments
- m
matrix of values
- color_cells
matrix of latex colors for matrix cells
- color_rownames
vector of latex colors for row names
- color_colnames
vector of latex colors for column names
Examples
# A matrix of zeros
m <- matrix(0, nrow = 2, ncol = 2)
# A matrix of NA values the same size as m
latex_colors <- m * NA
# Make the top row red
latex_colors[1,] <- "red"
# Insert colors into m
insert_latex_color(m, latex_colors)
#> [,1] [,2]
#> [1,] "\\color{red}{0}" "\\color{red}{0}"
#> [2,] "0" "0"