Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zeehio/condformat
R package to apply conditional formatting rules to a data.frame
https://github.com/zeehio/condformat
formatting html latex r-package table visualisation
Last synced: about 1 month ago
JSON representation
R package to apply conditional formatting rules to a data.frame
- Host: GitHub
- URL: https://github.com/zeehio/condformat
- Owner: zeehio
- License: other
- Created: 2015-05-20T22:49:05.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2023-10-10T04:15:16.000Z (about 1 year ago)
- Last Synced: 2024-10-13T09:14:08.628Z (2 months ago)
- Topics: formatting, html, latex, r-package, table, visualisation
- Language: R
- Size: 1.25 MB
- Stars: 25
- Watchers: 6
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - zeehio/condformat - R package to apply conditional formatting rules to a data.frame (R)
README
---
title: "Introduction to condformat"
author: "Sergio Oller"
date: "`r Sys.Date()`"
output: rmarkdown::github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```condformat renders a data frame in which
cells in columns are formatted according to several rules or criteria.
[![CRAN status](https://www.r-pkg.org/badges/version/condformat)](https://CRAN.R-project.org/package=condformat)
[![Downloads](https://cranlogs.r-pkg.org/badges/condformat)](https://cran.r-project.org/package=condformat)[![Documentation](https://img.shields.io/badge/documentation-pkgdown-informational)](https://zeehio.github.io/condformat/)
[![R build status](https://github.com/zeehio/condformat/workflows/R-CMD-check/badge.svg)](https://github.com/zeehio/condformat/actions)
[![codecov.io](https://codecov.io/github/zeehio/condformat/coverage.svg?branch=main)](https://app.codecov.io/github/zeehio/condformat)
## Browse source code
Checkout the code and browse it at
[https://github.com/zeehio/condformat](https://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:
```
remotes::install_github("zeehio/condformat")
```## Example
```{r fig-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 output engine support
| Rule | HTML | LaTeX | gtable | Excel |
| ------------------------ |:-----:|:-----:|:------:|:-----:|
| `rule_fill_discrete` | X | X | X | X |
| `rule_fill_gradient` | X | X | X | X |
| `rule_fill_gradient2` | X | X | X | X |
| `rule_text_color` | X | X | X | X |
| `rule_text_bold` | X | X | X | X |
| `rule_fill_bar` | X | | X | |
| `rule_css` | X | | | |