Learn R Programming

gtools R package

The gtools R package provides functions to assist in R programming, including:

  • assist in developing, updating, and maintaining R and R packages (ask, checkRVersion, getDependencies, keywords, scat),
  • calculate the logit and inverse logit transformations (logit, inv.logit),
  • test if a value is missing, empty or contains only NA and NULL values (invalid),
  • manipulate R’s .Last function (addLast),
  • define macros (defmacro),
  • detect odd and even integers (odd, even),
  • convert strings containing non-ASCII characters (like single quotes) to plain ASCII (ASCIIfy),
  • perform a binary search (binsearch),
  • sort strings containing both numeric and character components (mixedsort),
  • create a factor variable from the quantiles of a continuous variable (quantcut),
  • enumerate permutations and combinations (combinations, permutation),
  • calculate and convert between fold-change and log-ratio (foldchange, logratio2foldchange, foldchange2logratio),
  • calculate probabilities and generate random numbers from Dirichlet distributions (rdirichlet, ddirichlet),
  • apply a function over adjacent subsets of a vector (running),
  • modify the TCP_NODELAY (de-Nagle) flag for socket objects,
  • efficient rbind of data frames, even if the column names dont match (smartbind`),
  • generate significance stars from p-values (stars.pval),
  • convert characters to/from ASCII codes (asc, chr),
  • convert character vector to ASCII representation (ASCIIfy).
  • apply title capitalization rules to a character vector (capwords)

Installation

You can install the released version of gtools from CRAN with:

install.packages("gtools")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("r-gregmisc/gtools")

Copy Link

Version

Install

install.packages('gtools')

Monthly Downloads

182,166

Version

3.9.5

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

November 20th, 2023

Functions in gtools (3.9.5)

defmacro

Define a macro
dirichlet

Functions for the Dirichlet Distribution
scat

Display debugging text
running

Apply a Function Over Adjacent Subsets of a Vector
gtools-deprecated

Deprecated Functions in the gtools package
na.replace

Replace Missing Values
mixedsort

Order or Sort strings with embedded numbers so that the numbers are in the correct order
script_file

Determine the directory or full path to the currently executing script
split_path

Split a File Path into Components
loadedPackages

Provide Name, Version, and Path of Loaded Package Namespaces
smartbind

Efficient rbind of data frames, even if the column names don't match
logit

Generalized logit and inverse logit function
stat_mode

Most frequently occurring value
setTCPNoDelay

Modify the TCP_NODELAY (`de-Nagle') flag for socket objects
stars.pval

Generate significance stars from p-values
quantcut

Create a Factor Variable Using the Quantiles of a Continuous Variable
roman2int

Convert Roman Numerals to Integers
oddeven

Detect odd/even integers
permute

Randomly Permute the Elements of a Vector
unByteCode

Convert a byte-code function to an interpreted-code function
binsearch

Binary Search
ELISA

Data from an ELISA assay
keywords

List valid keywords for R man pages
capwords

Capitalize Words for Titles
ASCIIfy

Convert Characters to ASCII
combinations

Enumerate the Combinations or Permutations of the Elements of a Vector
assert

Defunct Functions in package gtools
lastAdd

Non-destructively construct a .Last function to be executed when R exits.
checkRVersion

Check if a newer version of R is available
foldchange

Compute fold-change or convert between log-ratio and fold-change.
badDend

Dataset That Crashes Base:::Plot.Dendogram with 'Node Stack Overflow'
baseOf

Transform an integer to an array of base-n digits
getDependencies

Get package dependencies
gtools

gtools: Various R Programming Tools
invalid

Test if a value is missing, empty, contains only NA or NULL values, or is a try-error.
asc

Convert between characters and ASCII codes
ask

Display a prompt and collect the user's response