Description Usage Arguments Details Value Examples
Use these functions to find a particular argument in an expression.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | formula_arg(ex, ..., n = 1L, message = "")
data_arg(ex, ..., n = 1L, message = "")
matrix_arg(ex, ..., n = 1L, message = "")
vector_arg(ex, ..., n = 1L, message = "")
character_arg(ex, ..., n = 1L, message = "")
numeric_arg(ex, ..., n = 1L, message = "")
list_arg(ex, ..., n = 1L, message = "")
function_arg(ex, ..., n = 1L, message = "")
table_arg(ex, ..., n = 1L, message = "")
arg_number(ex, n = 1L, ..., message = "")
first_arg(ex, ..., message = "")
named_arg(ex, nm, ..., message = "")
|
ex |
the tidy expression to check |
... |
passif/failif/okif tests |
n |
an integer. If there's more than one matching argument, which one do you want. |
message |
a character string. If this is not empty (i.e. |
nm |
the name of an argument as a character string (or a regex). |
If the expression isn't a call, it still has a value. These functions return that value if it's a match to the type sought. If ex directly from for_checkr(), only the first expression is checked.
the matching expression as a quosure that can be evaluated with eval_tidy().
1 2 3 4 5 6 7 8 | code <- for_checkr(quote(lm(mpg ~ hp, data = mtcars)))
formula_arg(code)
data_arg(code,
insist("hp" %in% names(V),
"The data should have a column named 'hp'."))
matrix_arg(code)
named_arg(code, "data", failif(E == `mtcars`, "I didn't want mtcars."))
arg_number(code, 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.