| to_lst | R Documentation |
to_lst() checks whether an argument can be coerced to a list without losing
information, returning it silently if so. Otherwise an informative error
message is signaled. to_list() is a synonym of to_lst().
to_lst(x, ..., x_arg = caller_arg(x), call = caller_env())
to_list(x, ..., x_arg = caller_arg(x), call = caller_env())
## S3 method for class 'list'
to_lst(x, ...)
## Default S3 method:
to_lst(x, ..., x_arg = caller_arg(x), call = caller_env())
## S3 method for class ''NULL''
to_lst(x, ..., allow_null = TRUE, x_arg = caller_arg(x), call = caller_env())
## S3 method for class ''function''
to_lst(
x,
...,
coerce_function = FALSE,
x_arg = caller_arg(x),
call = caller_env()
)
x |
The argument to stabilize. |
... |
Arguments passed to |
x_arg |
|
call |
|
allow_null |
|
coerce_function |
|
This function has important distinctions from base::as.list():
Functions can be rejected as part of the call to this function (with
coerce_function = FALSE, the default). If they are allowed, they'll be
coerced to a list concatenating their formals and body (as with
base::as.list().
Primitive functions (such as base::is.na() or base::is.list()) always
throw an error, rather than returning list(NULL).
NULL values can be rejected as part of the call to this function (with
allow_null = FALSE).
The argument as a list.
Other list functions:
specify_lst(),
stabilize_lst(),
stabilize_present()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.