| Title: | Zhang Liang's miscellaneous utilities |
|---|---|
| Description: | This package mainly contains some miscellaneous utilities that I use frequently. |
| Authors: | Liang Zhang [aut, cre] (ORCID: <https://orcid.org/0000-0001-9041-1150>) |
| Maintainer: | Liang Zhang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.10 |
| Built: | 2026-05-20 07:24:06 UTC |
| Source: | https://github.com/psychelzh/zutils |
This is basically a wrapper around rlang::call2() that allows you to
extract the arguments from a function and pass them to rlang::call2()
without having to type them out.
call_full(.fn, ...)call_full(.fn, ...)
.fn |
The function to call. |
... |
Arguments to pass to the function. |
A call to the function with its arguments.
This function is useful for when you want to evaluate an expression, but you want to catch any errors and return a default value instead. Note the error message will be printed as a warning as the name of the function suggests.
cautiously(.f, otherwise = NULL)cautiously(.f, otherwise = NULL)
.f |
A function to modify. See |
otherwise |
A value to return if the expression throws an error. |
A function that evaluates the expression and returns the result or the default value if an error is thrown.
A tidy select interface for lists. See tidyselect::eval_select()
for details.
select_list(.l, ...)select_list(.l, ...)
.l |
A |
... |
One or more unquoted expressions separated by commas. |
A list with the selected elements.
This is a wrapper around tidyr::separate_wider_regex() that allows to split
a column into multiple columns. The column contains so-called delimiter
separated values (DSV) and the values are extracted using regular
expressions.
separate_wider_dsv( data, col, names, ..., patterns = NULL, delim = "_", prefix = NULL, suffix = NULL )separate_wider_dsv( data, col, names, ..., patterns = NULL, delim = "_", prefix = NULL, suffix = NULL )
data |
A data frame. |
col |
< |
names |
Names of the new columns. Use |
... |
Additional arguments passed to |
patterns |
Regular expressions to extract the values from the column. If
|
delim |
Delimiter used in the column to separate different pieces of values. |
prefix, suffix
|
Prefix and suffix to be removed from the target column to retrieve the values. |
A data frame with the separated columns.