MyNixOS website logo
Description

Support Functions for Wrangling and Visualization.

Suite of helper functions for data wrangling and visualization. The only theme for these functions is that they tend towards simple, short, and narrowly-scoped. These functions are built for tasks that often recur but are not large enough in scope to warrant an ecosystem of interdependent functions.

supportR - Support Functions for Wrangling and Visualization

R-CMD-check GitHubissues GitHub pullrequests

supportR is an R package where the only unifying theme of the functions is honestly just that I wrote them. That said, there are some useful functions for data wrangling and plotting in particular, though functions for other purposes are also included. I’ll add functions to this package as I write more orphan scripts that I hope others might find useful so stay tuned!

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("njlyon0/supportR")

Data Wrangling

  • summary_table: Calculates summary values (mean, standard deviation, sample size, and standard error) of a given response variable within supplied groups

  • safe_rename: Renames columns in a given dataframe by matching ‘bad’ names with ‘good’ names

  • name_vec: Creates a named vector of specified contents and names. Useful when creating named vectors that are too long to create manually or when creating the vector and then naming it is cumbersome

  • crop_tri: Removes the specified “triangle” (either upper or lower) of a symmetric data object by replacing with NAs. Also allows user to specify whether to keep or also drop the diagonal

  • array_melt: “Flattens” an array of dimensions X, Y, and Z into a dataframe containing columns x, y, z, and value where value is whatever was stored in the array at those coordinates

Quality Control (QC)

  • diff_check: Compares two vectors and identifies what elements are found in the first but not the second (i.e., lost components) and what elements are found in the second but not the first (i.e., gained components). Extremely useful prior to joining two dataframes to compare index column contents or to ensure no columns are unexpectedly lost during complex wrangling operations

  • num_check: Checks column(s) that should contain only numeric values for any entries that would be coerced to NA if as.numeric is run

  • count: Counts instances of each unique element in a provided vector

  • date_check: Checks column(s) that should contain only date values for any entries that would be coerced to NA if as.Date is run

  • date_format_guess: Checks a column containing multiple ambiguous date formats and identifies its best guess for the format each date is in (e.g., ‘dd/mm/yyyy’ versus ‘yyyy/dd/mm’, etc.)

Visualization & Graphics

  • theme_lyon: Applies a set of modifications to the non-data aspects of a ggplot2 plot to ensure a consistent “feel” of a set of plots

  • ordination: Creates an ordination for either the nonmetric multidimensional scaling (NMS) dissimilarity matrix created by vegan::metaMDS or for the principal coordinates analysis (PCoA) distance matrix returned by ape::pcoa

Operations Outside of R

  • github_ls: Lists contents of a GitHub repository from its URL and returns a simple dataframe containing the name, type, and file path of identified objects. Supports recursive listing (i.e., listing of contents of subfolders identified in first list of contents)

  • github_tree: Creates a file tree diagram of a GitHub repository from its URL

  • tabularize_md: Converts a markdown file into a table that retains the nested structure of any headings in the file. Accepts either the file name/path locally or a URL connection to a markdown file hosted online (e.g., a GitHub repository README.md, etc.)

  • rmd_export: Allows knitting of a specified R Markdown file locally and simultaneously to a specified Google Drive folder. NOTE: you must authorize R to work with Google Drive by using googldrive::drive_auth() for this function to work

Looking Ahead

More functions are likely to be developed and housed within this package so stay tuned! Feel free to post ideas for new functions as an issue on this repository and I’ll do my best to build them!

Metadata

Version

1.4.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows