Condformat
R package to apply conditional formatting rules to a data.frame
Install / Use
/learn @zeehio/CondformatREADME
Introduction to condformat
Sergio Oller 2023-10-08
<!-- README.md is generated from README.Rmd. Please edit that file -->condformat renders a data frame in which cells in columns are formatted according to several rules or criteria.
<!-- badges: start --> <!-- badges: end -->Browse source code
Checkout the code and browse it at 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
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 | | | |
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
