View source: R/type-data-frame.R
df_list | R Documentation |
df_list()
constructs the data structure underlying a data
frame, a named list of equal-length vectors. It is often used in
combination with new_data_frame()
to safely and consistently create
a helper function for data frame subclasses.
df_list(
...,
.size = NULL,
.unpack = TRUE,
.name_repair = c("check_unique", "unique", "universal", "minimal", "unique_quiet",
"universal_quiet"),
.error_call = current_env()
)
... |
Vectors of equal-length. When inputs are named, those names are used for names of the resulting list. |
.size |
The common size of vectors supplied in |
.unpack |
Should unnamed data frame inputs be unpacked? Defaults to
|
.name_repair |
One of |
.error_call |
The execution environment of a currently
running function, e.g. |
Inputs are recycled to a common size with
vec_recycle_common()
.
With the exception of data frames, inputs are not modified in any way. Character vectors are never converted to factors, and lists are stored as-is for easy creation of list-columns.
Unnamed data frame inputs are automatically unpacked. Named data frame inputs are stored unmodified as data frame columns.
NULL
inputs are completely ignored.
The dots are dynamic, allowing for splicing of lists with !!!
and
unquoting.
new_data_frame()
for constructing data frame subclasses from a validated
input. data_frame()
for a fast data frame creation helper.
# `new_data_frame()` can be used to create custom data frame constructors
new_fancy_df <- function(x = list(), n = NULL, ..., class = NULL) {
new_data_frame(x, n = n, ..., class = c(class, "fancy_df"))
}
# Combine this constructor with `df_list()` to create a safe,
# consistent helper function for your data frame subclass
fancy_df <- function(...) {
data <- df_list(...)
new_fancy_df(data)
}
df <- fancy_df(x = 1)
class(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.