parsing_args: parse arguments of function before execution

Description Usage Arguments Details Examples

Description

A wrapper around readr::parse_guess to help deal easily with unconverted user input.

Usage

1
2
3
parsing_args(.args = NULL, .eval = FALSE, .na = c("", "NA"),
  .locale = readr::default_locale(), .trim_ws = TRUE,
  .guess_integer = FALSE)

Arguments

.args

character vector of arguments to consider, if NULL (default) all arguments are candidates to be parsed.

na

Character vector of strings to interpret as missing values. Set this option to character() to indicate no missing values.

locale

The locale controls defaults that vary from place to place. The default locale is US-centric (like R), but you can use locale() to create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names.

trim_ws

Should leading and trailing whitespace be trimmed from each field before parsing it?

guess_integer

If TRUE, guess integer types for whole numbers, if FALSE guess numeric type for all numbers.

Details

Character inputs that are not parsed to other types by readr::parse_guess are evaluated with eval(parse(text=...)) if .eval is set to TRUE.

Non character inputs will not be converted, however they will be evaluated if they are mentionned in .args or if .args is NULL

Examples

1
2
3
parsing_args(.eval=TRUE)$head("cars", n= "2")
parsing_args(.args = "n")$head(cars, n= "2")
parsing_args$head(cars, n= "2")

moodymudskipper/tags documentation built on June 25, 2019, 10:54 a.m.