quick_dfl() is now deprecated #91match_ext functions have minor improvements for direct
aliases and documentation updates #86quick_df() no longer allows NULL values in
the input list #81quick_df() is now a little faster #91list() is now a little faster #91list0()’s functionality to ignore empty inputs can be
disabled if options(fuj.list.active = FALSE) before
{fuj} is loaded #91set_file_ext() and file_ext<-() added
for controlling file extensions #89+ and / methods added for
file_path classes, allowing path creation (e.g.,
fp("folder") / "subfolder" / "file" + "extension") #89hold() and toss() are added for retaining
and removing values in a vectors #85negate() and not() added to negate
functions #84encode() and fact() added to encode values
and create factors #87np() added for normalizing file paths #100fp() no longer normalizes file paths #100match_arg() added for and internally used #102delay() added as a wrapper for passing an expression
into on.exit() (similar to
withr::defer())require_namespace() no longer loads the namespace being
checked #111require_namespace() now
requires <package> <op> <version> to be
space delimited. Optionally, a list() can be used with the
three components included (e.g.,
require_namespace(list("fuj", ">=", "0.2.2"), list("base", "==", getRversion()))conditionsGeneral improvements for conditions #90
BREAKING new_condition(type) now defaults
to "condition" rather than "error"BREAKING new_condition() with a package
not uses <package>::<class> names, rather than
<package>:<class> namesnew_condition() transformations on class
have been adjusted
camelCase; likewise,
the base fujCondition class is now
fuj_conditiontype specified
(e.g., my_error, my_warning); the value of the
type field is automatically appended to each element in
class if it doesn’t already exist. This behavior can be
controlled by using an AsIs class (e.g., class =
I("exactly_this_class"))class can now be a list for more control
(e.g., class = list("value", I("exact value")))new_condition(pkg) is deprecated in favor of
new_condition(package)new_condition(msg) is deprecated in favor of
new_condition(message); message is now the
first argumentnew_condition() now only accepts message,
class, and type as positional arguments with
the include of ...; all other arguments must be explicitly
namedinput_error(), class_error(),
value_error(), warning equivalents and more (see all with
?fuj::conditions)error_condition()/err(),
warning_condition()/wrn(),
message_condition()/msg() exported for
simple conditions (e.g.,
message(msg("this is a message")) [#105]{fuj} now simplifies use of
new_condition()
{fuj} have been simplified
through the use of generic condition classes (e.g.,
input_error, type_error,
class_error)verbose_message will try to avoid printing a message
when options(fuj.verbose = FALSE) is setvap familyIncludes new vap family functions; essentially familiar
wrappers for apply functions #83
vaps are vector apply functions, with certain presets
to assist with common casesvap functions have type-stable variants:The below table shows inputs for vap functions and how
they behave with the provided functions (f). Arguments to
f()) can use any name.
vap function |
f args |
|---|---|
vap(x, f) |
f(x) |
vap2(x, y, f) |
f(x, y) |
vap3(x, y, z, f) |
f(x, y, z) |
vapi(x, f) |
f(x, i) |
vapp(p, f) |
f(...) |
Note: vapi() uses either the index or names of
x as the second argument to f.
Each vap function comes with the following type
variants. If you are not concerned about type safety,
usevap_vec().
| Function | Output Type | Conversion |
|---|---|---|
*_chr() |
character | as.vector(_, "character") |
*_dbl() |
double/numeric | as.vector(_, "double") |
*_int() |
integer | as.vector(_, "integer") |
*_lgl() |
logical | as.vector(_, "logical") |
*_raw() |
raw | as.vector(_, "raw") |
*_cpl() |
complex | as.vector(_, "complex") |
*_date() |
Date | as.Date(as.vector(_, "double"), origin = "1970-01-01") |
*_dttm() |
POSIXct | as.POSIXct(as.vector(_, "double"), origin = "1970-01-01", tz = "UTC") |
Note: these variants do not perform checks on
output results, but rather coerce the output to the specified type.
These do not function the same as vapply(), which is
recommended for more aggressive type checking.
require_namespace() now produces a more reasonable
error when specifying a version #63yes_no() prompting #64package() utility as the default for
new_condition(pkg = package()) #67new_condition() now allows
type = "message" #74quick_df(list()) now works #72struct() #78lst() again works with NA_character_ #60fp() added for creating file path objects with
is_path() as a means of checking for the class;
file_path() and is_file_path() exported as
aliases, respectively #55include() added as a means of partially attaching a
package with specific exports #49op.fuj, a named list of default options for
{fuj} is now exportedverbose() #50
verbose() has additional options for controlling the
message output #36
.label can be set to a string to prepend to the message
(defaults to "[verbose]").fill can be set to repeat .label on each
line of the message (defaults to FALSE).verbose can be set to TRUE to print the
message rather than relying on options()verbose() prints prepended with "verbose "
instead of "[verbose] " #42make_verbose() is included to create a verbose function
that will be triggered with a configured option, rather than the default
getOption("fuj.verbose", getOption("verbose")) pattern.
This can be used to define your own custom verbose function:lst() exported as an alias for
list0()library(fuj)
options(fuj.verbose = FALSE)
verbose("will not show")
options(my.verbose = TRUE)
my_verbose <- make_verbose("my.verbose")
my_verbose("will show")
#> [verbose] will show%||% is now copied from {base} when
available (R versions >= 4.4) #35{covr} dropped as a suggest
dependencyrequire_namespace() now allows for version requirements
(e.g., require_namespace("fuj>=0.1.4")). When the
version requirement is not met, an error of class
namespaceVersionError is returned #41simpleErrors converted to custom errors #43%::% and %:::% (which now aliases
%colons$) or retrieving exported and non-exported values
from namespaces #31verbose() for conditional message printing #29jmbarbone/actions/r-check-versionlist0() now accepts named arguments in
... #25new_condition() gains a pkg argument to
control for prepending a package name to the condition call. The default
value of TRUE will try to find the
.packageName object from your package. Change the default
setting of pkg to prevent this addition. #12require_namespace() can now accept multiple namespaces.
The first namespace not found will throw an error #14list0() now correctly throws valid errors #19subset2 is now exported as an alias of [[
and subset3 is added as an alias of $ #3NEWS.md file to track changes to the
package.