omnibus: omnibus: Fantabulous helper functions

omnibusR Documentation

omnibus: Fantabulous helper functions

Description

This package contains a set of helper functions.

Details

Create an issue on GitHub.

Data manipulation and properties

appendLists: Merge lists, appending elements with the same name.
bracket: Find values that bracket a given number.
combineDf: Combine data frames with different schema.
compareFloat: Compare values to floating-point precision.
corner: Corner of a matrix or data frame.
convertUnits: Convert length or areal units.
conversionFactors: Data frame of conversion factors for length or areal units.
cull: Force vectors or matrices/data frames to have the same length or number of rows.
expandUnits: Convert unit abbreviations to proper unit names.
insert: Insert values into a vector.
insertCol and insertRow: Insert column(s)/row(s) in a matrix or data frame.
maxRuns: Maximum number of continuous "runs" of values meeting a particular condition.
mirror: Flip an object left-right (or up-down).
mmode: Modal value(s).
mergeLists: Merge lists, with precedence for elements of one list over another if they have the same names.
notIn and %notin%: Opposite of %in%.
renameCol: Rename a column.
renumSeq: Renumber a sequence.
rotateMatrix: Rotate a matrix.
roundTo: Rounds a value to the nearest target value.
rowColIndexing: Convert between row and column indexing of a matrix.
side: Left/right side of a data frame or matrix.
stretchMinMax: Rescale values to a given range.
unlistRecursive: For any object in a list that is also a list, unlist it.
unragMatrix: Turn a "ragged" matrix into a "ragged" vector.

Dates

domLeap: Data frame of days of each month in a leap year.
domNonLeap: Data frame of days of each month in a non-leap year.
doyLeap: Data frame of days of year in a leap year.
doyNonLeap: Data frame of days of year in a non-leap year.
isLeapYear: Is a year a leap year?
yearFromDate: Attempt to find the year across dates with non-standard formats.

Geometry

pairDist: Pairwise Euclidean distance between two sets of points.
quadArea: Area of a quadrilateral.

Handling NAs

%<=na%, %==na%, %!=na%, %>na%, and %>=na%: Comparative operations (>, >=, ==, !=, <, <=) but returns FALSE for NA cases (versus NA).
isTRUENA and isFALSENA: Logical operators robust to NA.
naCompare: Comparative operations (>, >=, ==, !=, <, <=) but returns FALSE for NA cases (versus NA).
naOmitMulti: Remove elements of multiple vectors if at least one element is NA or rows of matrices/data frames if at least one row has an NA.
naRows: Indices of rows with at least one NA. Same as which(!complete.cases(x)).

Data properties

countDecDigits: Count number of digits after a decimal.
longRun: Longest run of a given sequence in a vector.
is.wholeNumber: Is a value a whole number to within floating-point precision?.
roundedSigDigits: Infers the number of significant digits represented by a decimal representation of a division operation or digits place to which an integer was rounded.
which.pmax and which.pmin: Combine which.max with pmax, and which.min with pmin (vectorized which.max and which.min).

System

dirCreate: Nicer version of dir.create.
eps: Smallest floating point value your computer can think of.
listFiles: Nicer version of list.files.
memUse: Display largest objects in memory.

Text

capIt: Capitalize first letter of a string.
forwardSlash: Replace backslash with forward slash.
pmatchSafe: Partial matching of strings with error checking.
prefix: Add repeating character to a string to ensure it has a user-defined length (e.g., 7 –> 007).
rstring: Make a nearly-guaranteed unique string.
say: Replacement for print('abc'); flush.console.

Author(s)

Adam B. Smith

See Also

Useful links:


omnibus documentation built on Sept. 17, 2024, 5:09 p.m.