class-date_tbl: 'date_tbl': A 'tibble' with a 'date' Attribute

Description Usage Arguments Value

Description

date_tbl() is a subclass of tibble that stores a date attribute as metadata. This is useful, for example, in tracking the report date of a dataset.

as_date_tbl() converts an object to a date_tbl

is_date_tbl() tests whether an object is a date_tbl

new_date_tbl() constructs a date_tbl from a tibble-like object and a date with minimal checking

validate_date_tbl() validates the properties of a date_tbl

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
as_date_tbl(
  x,
  date,
  .rows = NULL,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  rownames = pkgconfig::get_config("tibble::rownames", NULL)
)

is_date_tbl(x)

new_date_tbl(x, date, nrow = vctrs::vec_size(x))

validate_date_tbl(x)

Arguments

x

A date_tbl, tibble-like object, or an object to test for inheritance from date_tbl. In as_date_tbl(), this can be anything coercable to a tibble; new_date_tbl() does less work and is somewhat stricter about the input. is_date_tbl() and validate_date_tbl() will take any object, but will return FALSE or an error (respectively) if the object is not a properly created date_tbl.

date

A Date or datetime (POSIXt) object of length 1

.rows

The number of rows, useful to create a 0-column tibble or just as an additional check.

.name_repair

Treatment of problematic column names:

  • "minimal": No name repair or checks, beyond basic existence,

  • "unique": Make sure names are unique and not empty,

  • "check_unique": (default value), no name repair, but check they are unique,

  • "universal": Make the names unique and syntactic

  • a function: apply custom name repair (e.g., .name_repair = make.names for names in the style of base R).

  • A purrr-style anonymous function, see rlang::as_function()

This argument is passed on as repair to vctrs::vec_as_names(). See there for more details on these terms and the strategies used to enforce them.

rownames

How to treat existing row names of a data frame or matrix:

  • NULL: remove row names. This is the default.

  • NA: keep row names.

  • A string: the name of a new column. Existing rownames are transferred into this column and the row.names attribute is deleted. Read more in rownames.

nrow

The number of rows, required.

Value

A date_tbl


jesse-smith/covidsms documentation built on Dec. 25, 2021, 4:24 a.m.