Learn R Programming

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

jwutil

master:

This is a set of simple utilities for various data manipulation and caching tasks. The goal is to use base functions 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.2.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jack O Wasey

Last Published

June 11th, 2018

Functions in jwutil (1.2.1)

asNumericNoWarn

convert factor or vector to numeric without warnings
countIsNa

count NA in vector
combn_subset

all unique combinations of a vector and all its non-zero subsets
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.
dput_expect_equal

dput a testthat test
affixFields

update a set of data frame field names
env_to_vec_flip

return a new environment with names and values swapped
getNAFields

get NA field names from data frame
drop_duplicate_fields

drop duplicate fields
dropRowsWithNAField

drops rows with NA values in specified fields
countNonNaCumulative

running totals of number of non-NA values in consecutive fields
%eine%

%in%/match equivalent for two environment arguments
factor_nosort

Fast Factor Generation
extreme_numbers

extreme numbers
getDropped

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

flatten a list
countNonNaPairs

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

convert factor into a data.frame of logicals
%nin%

inverse of %in%
get_numeric_char_field_names

Find columns which are numeric
isFlat

determine whether a list is nested
invwhich

inverse which
lsos

show largest objects
lsf

list all functions in a package
fastIntToString

Fast convert integer vector to character vector
lsp

list all items in a package
get_factor_fields

get names of the factor fields in a data frame
is.Date

is the object a Date
mergeLists

merge lists by names
platformIsLinux

Are we running on Linux, Mac or Windows?
propIsNa

Proportion of NA values in a vector
isValidTime

check if a time is valid in 24h clock
countNotNumeric

count non-numeric elements
propNaPerField

return proportion of NA values per field
propRowSorted

proportion of non-descending rows in matrix
merge_better

Merge better
shuffle

shuffle
countNumeric

count numeric elements
source_purl

Extract code from knitr vignette and source it
fillMissingCombs

fill out missing combinations of factors with NA
filter_better

filter data with diagnostics
logical_to_binary

Encode TRUE as 1, and FALSE as 0 (integers)
zero_na

Zero NA values in a data.frame
read_xlsx_linux

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

minimal basic pre-processing metrics
zeroes

zeroes
ls.objects

Summarize objects
numbers_to_long_and_float

convert numbers to long and float types
min_r_version

Find minimum R version required for package
permute

generate all permutations of input
permuteWithRepeats

generate all permutations of input, reusing values in each result row
opt_binary_brute

optimizes a function for all combinations of all subsets
jwutil-package

Tools for testing and data manipulation not found elsewhere
listTrim

trim null or empty values from a list
strMultiMatch

return the actual matches from a bracketed regex
reqinst

Load packages with library, installing any which are missing
strip

strip all whitespace
rm_r

recursive remove
listTrimFlat

trim null or empty values from a list
trim

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

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

generate random Dates or POSIXlt test datetimes
read_zip_url

read file from zip at URL
random_test_numbers

create extreme random numbers
unzip_single

unzip a single file from URL
save_in_data_dir

Save given variable in package data directory
unzip_to_data_raw

Unzip file to data-raw
set_attr_in_place

Set attribute on any SEXP in place
update_github_pkgs

Update github_install packages
vec_to_env_true

create environment from vector
areNumeric

which elements of a vector are numeric
allIsInteger

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

check whether character vector represents all numeric values
build_formula

build simple linear formula from variable names
as_char_no_warn

convert to character vector without warning
binary_col_names

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

convert separate lists of dates and times to POSIXlt objects
bad_input

bad input data for tests