jamba: jamba: Jam Base Methods

jambaR Documentation

jamba: Jam Base Methods

Description

The jamba package contains several jam base functions which are re-usable for routine R analysis work, and are important dependencies for other Jam R packages.

Details

The goal will be to maintain these methods as lightweight as possible, so their inclusion in an analysis workflow will not incur a noticeable burden.

The sections and functions below are not comprehensive, but provide examples of useful functions. The most highly-used functions are: printDebug(), vigrep(), nameVector() with makeNames(), pasteByRow(), showColors().

plot functions

  • Enhanced graphics::smoothScatter() with plotSmoothScatter().

  • Enhanced graphics::image() with imageDefault() for rasterized heatmaps that preserve aspect ratio for non-square images; imageByColors() for data.frame of colors and optional labels, which by default places unique labels centered within a block of repeated values.

  • Quick color display showColors() for vector or list of color vectors.

  • Quick blank plot nullPlot() with optional labeling of margins.

  • Log-scaled axis labels minorLogTicksAxis().

  • Text labels using a border outline shadowText() for visible contrast.

  • Base plot wrappers getPlotAspect(), decideMfrow().

string functions

  • Alphanumeric sort with mixedSort(), mixedOrder(), mixedSortDF()

  • Custom wrappers to grep() for value-return vgrep(), vigrep(); case-insensitive pattern search igrep(), vigrep(); and grep with an ordered vector of patterns provigrep(), proigrep().

  • Name manipulations: make unique names with defined syntax makeNames(); applying names to a vector nameVector(); named vector of names nameVectorN() useful with lapply().

  • Row-wise concatenation from data.frame or matrix pasteByRow() optionally skipping blank values; list to matrix without filling missing values rbindList().

  • Sorted base::table() with optional filter tcount().

color functions

  • Color interconversion functions designed to be reversible, e.g. col2hcl() and col2hcl().

  • Set text contrast color for labels on colored background setTextContrastColor().

  • Color wrapper functions makeColorDarker(), getColorRamp(), showColors().

miscellaneous helper functions

  • Colored text output printDebug(), colored R prompt setPrompt(), vectorized text styling make_styles().

  • Interconversion from degrees to radians deg2rad(), rad2deg().

  • Simple date string functions getDate(), asDate(), dateToDaysOld(), isDate(), fileInfo().

  • Padding character strings or integers with leading or trailing values padString(), padInteger().

  • Removing or editing missing values in place: rmNA(), rmNULL(), rmInfinite().

Jam options

The jamba package recognizes some global options, but limits these options to include only non-analysis options. For example, no global option should change the numerical manipulation of data.

  • jam.lightMode - boolean, defines whether the text background is light (TRUE is bright) or dark (FALSE is dark) mainly for the purpose of restricting text output colors from printDebug so they have visible contrast.

  • jam.adjustRgb - numerical setting used as a small adjustment of colors used by the crayon functions to produce ANSI color text.

See Also

Other jam practical functions: breakDensity(), checkLightMode(), check_pkg_installed(), colNum2excelName(), color_dither(), diff_functions(), exp2signed(), fileInfo(), fixYellow(), getAxisLabel(), handleArgsText(), heads(), isFALSEV(), isTRUEV(), jargs(), kable_coloring(), lldf(), log2signed(), make_html_styles(), make_styles(), match_unique(), mergeAllXY(), middle(), minorLogTicks(), newestFile(), printDebug(), renameColumn(), rmInfinite(), rmNAs(), rmNA(), rmNULL(), sclass(), sdim(), setPrompt()


jmw86069/jamba documentation built on Oct. 9, 2024, 10:52 a.m.