Cheap data frame utilities
new_df(..., .nrows = NULL, .recycle = TRUE, .name_repair = TRUE, .args = NULL)as_df(x)
fast_df(..., .args = NULL)
list_as_df(x)
name_repair(x, dup_sep = "_", empty_sep = "col_")
unique_name_repair(x, dup_sep = "_", empty_sep = "col_")
col_c(..., .recycle = TRUE, .name_repair = TRUE, .args = NULL)
row_c(..., .args = NULL)
A data.frame
.
name_repair
takes a character vector and returns unique strings by
appending duplicate string locations to the duplicates.
This is mostly used to create unique col names.
Key-value pairs.
[integer(1)]
- (Optional) number of rows.
Commonly used to initialise a 0-column data frame with rows.
[logical(1)]
- Should arguments be recycled?
Default is TRUE
.
[logical(1)]
- Should duplicate and empty names
repaired and made unique? Default is TRUE
.
An alternative to ...
for easier programming with lists.
An object to coerce to a data.frame
or a character vector
for unique_name_repair()
.
[character(1)]
A separator to use between
duplicate column names and their locations. Default is '_'
[character(1)]
A separator to use between the empty
column names and their locations. Default is 'col_'
fast_df()
is a very fast bare-bones version of new_df()
that
performs no checks and no recycling or name tidying, making it appropriate
for very tight loops.