Learn R Programming

⚠️There's a newer version (1.2.3) of this package.Take me there.

jwutil

master:

v1.1dev:

This is a set of simple utilities for various data manipulation and caching tasks. The goal is to use base tools well, without bringing in any dependencies. Main areas of interest are data frame manipulation, such as converting factors in multiple binary indicator columns, and disk caching of data frames (which is optionally done by date range). There are testing functions which provide testthat extensions to permute arguments to function calls.

install from CRAN

install.packages("jwutil")

install from github

library(devtools)
install_github("jackwasey/jwutil")

Copy Link

Version

Install

install.packages('jwutil')

Monthly Downloads

6

Version

1.1.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jack O Wasey

Last Published

October 18th, 2016

Functions in jwutil (1.1.1)

allIsNumeric

check whether character vector represents all numeric values
add_time_to_date

convert separate lists of dates and times to POSIXlt objects
binary_col_names

names of fields which are numeric, binary or combinations thereof
areNumeric

which elements of a vector are numeric
bad_input

bad input data for tests
buildLinearFormula

build simple linear formula from variable names
allIsInteger

check whether vector represents all integer values, not that the same as is.integer
countNotNumeric

count non-numeric elements
combn_subset

all unique combinations of a vector and all its non-zero subsets
countIsNa

count NA in vector
countNonNaCumulative

running totals of number of non-NA values in consecutive fields
countNumeric

count numeric elements
expandFactors

Takes factors from a data frame and converts them to true/false fields with appropriately named fields.
dropRowsWithNAField

drops rows with NA values in specified fields
countNonNaPairs

count which combinations of fields have at least one non-NA
dput_expect_equal

dput a testthat test
dropDuplicateFields

drop duplicate fields
%nin%

inverse of %in%
getNAFields

get NA field names from data frame
factorToDataframeLogical

convert factor into a data.frame of logicals
fillMissingCombs

fill out missing combinations of factors with NA
expect_that_combine_all_args

alternative expect_that from testthat which permutes all the inputs to a function which should give the same result where n args >=2 and the function is commutative.
getFactorNames

get names of the factor fields in a data frame
flattenList

flatten a list
getDropped

get items or numerics that would be dropped in a merge
filterBetter

filter data with diagnostics
extreme_numbers

extreme numbers
invwhich

inverse which
listTrim

trim null or empty values from a list
is.Date

is the object a Date
isFlat

determine whether a list is nested
isRowSorted

is every row sorted?
listTrimFlat

trim null or empty values from a list
logicalToBinary

encode TRUE as 1, and FALSE as 0 (integers)
isValidTime

check if a time is valid in 24h clock
opt_binary_brute

optimizes a function for all combinations of all subsets
numbers_to_long_and_float

convert numbers to long and float types
lsf

list all functions in a package
jwutil-package

Tools for data manipulation not found elsewhere, and testthat extensions
random_test_dates

generate random Dates or POSIXlt test datetimes
random_test_numbers

create extreme random numbers
zero_na

zero NA values in a data.frame
source_purl

extract code from knitr vignette and source it
lsos

show largest objects
lsp

list all items in a package
trim

strip whitespace from ends of each string in given character vector
propNaPerField

return proportion of NA values per field
propRowSorted

proportion of non-descending rows in matrix
strip

strip all whitespace
zeroes

zeroes
permute

generate all permutations of input
rm_r

recursive remove
permuteWithRepeats

generate all permutations of input, reusing values in each result row
read.zip.url

read file from zip at URL
stripForFormula

strip a string so that it can be used as a variable name in a formula.
propIsNa

Proportion of NA values in a vector
platformIsLinux

Are we running on Linux, Mac or Windows?
read_xlsx_linux

read .xlsx file, interpret as CSV, and return a data frame
save_in_data_dir

Save given variable in package data directory
strMultiMatch

return the actual matches from a bracketed regex
mergeBetter

merge better
shuffle

shuffle
mergeLists

merge lists by names
set_attr_in_place

Set attribute on any SEXP in place
asCharacterNoWarn

convert factor or vector to character without warnings
affixFields

update a set of data frame field names
asNumericNoWarn

convert factor or vector to numeric without warnings