R package to apply conditional formatting rules to a data.frame
R
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R Fix theme_kable when a NULL argument is passed Nov 20, 2017
inst/shinyexample
man
tests Simplify test Nov 19, 2017
vignettes rule_fill_bar support Nov 16, 2017
.Rbuildignore Add cran-comments Mar 7, 2016
.gitignore Add first draft of a vignette with an example May 20, 2015
.travis.yml Try 3 R versions Oct 19, 2017
DESCRIPTION Add grob engine Nov 20, 2017
LICENSE License: Neither the name of the <copyright holders> nor... Jul 25, 2016
NAMESPACE Add grob engine Nov 20, 2017
NEWS.md Add grob engine Nov 20, 2017
README.Rmd Add grob engine Nov 20, 2017
README.md Add grob engine Nov 20, 2017
condformat.Rproj Fixes checks, uses --as-cran. May 21, 2015
cran-comments.md Bump version to 0.7.0 for CRAN release Oct 19, 2017

README.md

Introduction to condformat

Sergio Oller 2017-11-20

condformat renders a data frame in which cells in columns are formatted according to several rules or criteria.

Downloads Build Status codecov.io

Browse source code

Checkout the code and browse it at http://github.com/zeehio/condformat.

How to install condformat:

Dependencies

If you want to use the PDF output you will need the xcolor LaTeX package. Either use the full texlive distribution, or install latex-xcolor on Debian and derivatives.

Package installation

  • From CRAN:

    install.packages("condformat")
    
  • To install the latest development version:

    devtools::install_github("zeehio/condformat")
    

Example

data(iris)
library(condformat)
condformat(iris[c(1:5,70:75, 120:125),]) %>%
  rule_fill_discrete(Species) %>%
  rule_fill_discrete(c(Sepal.Width, Sepal.Length),
                     expression = Sepal.Width > Sepal.Length - 2.25,
                     colours = c("TRUE" = "#7D00FF")) %>%
  rule_fill_gradient2(Petal.Length) %>%
  rule_text_bold(c(Sepal.Length, Species), Species == "versicolor") %>%
  rule_text_color(Sepal.Length,
                  expression = ifelse(Species == "setosa", "yellow", "")) %>%
  rule_fill_bar(Petal.Width, limits = c(0, NA)) %>%
  theme_grob(rows = NULL) %>%
  condformat2grob()

This example covers most of the condformat rules.

Rules and engine support

Rule HTML LaTeX gtable
rule_fill_discrete X X X
rule_fill_gradient X X X
rule_fill_gradient2 X X X
rule_text_color X X X
rule_text_bold X X X
rule_fill_bar X X
rule_css X