Title: | paint data.frames summaries in colour |
---|---|
Description: | Provides an alternative to the print() methods provided by the authors of `data.frame` objects: `tibble`, `sf`, `data.table`, `data.frame`. |
Authors: | Miles McBain [aut, cre] |
Maintainer: | Miles McBain <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.7 |
Built: | 2024-12-02 03:12:34 UTC |
Source: | https://github.com/milesmcbain/paint |
This function calls paint()
repeatedly on a dataframe,
updating the rows shown in response to left or right keypresses.
ipaint(df = .Last.value)
ipaint(df = .Last.value)
df |
the dataframe to scroll through, defaults to |
It will only work in terminals supported by keypress - Not many!
This function replaces the original paint methods for supported data.frame
sub classes with calls to paint()
in the current session. The utility of
this is that paint()
will be called whenever print()
would, for example
at the end of an expression when coding interactively.
mask_print() unmask_print()
mask_print() unmask_print()
This also makes paint usable with other tools that output to console e.g. {breakerofchains}
.
If you really like paint()
you could put paint::mask_print()
in your .Rprofile
.
By default a colourful reminder message is emitted whenever print methods are
replaced, which may not happen until the package that contains them is actually
loaded, e.g. after library(tibble)
. This can be disabled with options(paint_remind_mask_print = FALSE)
unmask_print
: the reverse operation to mask_print
: return all print methods to defaults.
unpaint()
A method for calling the default print functions once for a single object or .Last.value.
paint is an alternative print method of objects that are of class
data.frame
. It has been described as a "pretty pillar::glimpse()
", since it
also favours printing columns running horizontally.
paint(df, ...)
paint(df, ...)
df |
the dataframe to paint |
... |
further arguments to class specific paint methods |
paint tries to be low noise by using colour instead of markup characters.
It also highlights important values like NA
, NULL
, NaN
, and Inf
.
Each supported sub-class of data.frame
has a custom meta data header,
designed to show useful information for wrangling.
The appearance of the output can be customised with options:
paint_palette
the palette to paint row colours with, defaults to
rainbow_6()
, 6 standard ANSI colours that are supported in most terminals.
paint_n_rows
the number of rows to print for each column. Defaults to the
number of colours in the paint_palette
, but can be set higher for repeating sequences.
paint_max_width
the maximum width of the output. 60 is the default. {paint}
does not resize
based on terminal width by design.
paint_align_row_head = c("left", "center", "right")
. How to align the column
title and type. Defaults to "left"
.
paint_dark_mode
darken the paint_palette
using crayon::blurred
- not
supported in all terminals.
df invisibly. Text outputed printed to console.
unpaint()
for calling the default print method on a dataframe
paint(mtcars)
paint(mtcars)
paintpals
rainbow_6() viridis_6() brewer_set3_12() brewer_pastel1_8() brewer_pastel2_7() brewer_dark2_7() brewer_accent_7()
rainbow_6() viridis_6() brewer_set3_12() brewer_pastel1_8() brewer_pastel2_7() brewer_dark2_7() brewer_accent_7()
Exported just for fun.
rainbow_text(msg)
rainbow_text(msg)
msg |
a length one character vector (not length checked) to be coloured
using the palette set in the |
a character vector with ANSI colour codes embedded. use cat() to see the coloured message.
If you're using paint()
as your default print()
for dataframes, you may
occasionally want to see an object printed using it's default method. This
function does that.
unpaint(df = .Last.value)
unpaint(df = .Last.value)
df |
the object to print. |
Either supply the object as the df
arg, or if it has just been painted, you
can call unpaint()
with no arguments to print the .Last.value
.
mask_print()
to use paint()
by default for dataframes in the current session over print()
.