rr_snapshot: A snapshot of a whole register

Description Usage Arguments Details Value Examples

Description

Returns a register as it was at a given time, with no history and no future.

Use rr_records() for snapshots of specifically a register's schema or its data, but without adjusting the data to the schema of the same time.

Usage

1
2
rr_snapshot(register, sequence = c("entry-number", "timestamp"),
  maximum = NULL, include_maximum = TRUE, parse_datetimes = FALSE)

Arguments

register

An object of class register, returned by rr_register().

sequence

One of "entry-number" (default) or "timestamp". The snapshot is taken at the maximum value of this field of register$entries.

maximum

An integer if sequence is "entry-number" orPOSIXctifsequenceis"timestamp", giving the time at which to take the snapshot. Only the latest entry up to this value will be kept, perkey'. By default it is the maximum of all entries, to return the most recent state of the register.

include_maximum

Logical, whether to include entries whose entry-number or timestamp equals maximum.

parse_datetimes

Logical, whether to parse ISO8601 strings as datetimes with parsedate::parse_iso_8601(), otherwise leave as a string. Partial datetimes are parsed as the earliest possible datetime, e.g. "2018" becomes "2018-01-01 UTC".

Details

A record is the latest entry for a given key. 'Latest' can be either the maximum entry-number (recommended), or the maximum timestamp. An entry timestamp may be NA, and may not be unique. If the timestamp of any entry of a given key is NA, then no record for that key will be returned. If the timestamp is not unique, then the entry with the maximum entry-number will be chosen.

Value

A tibble of records (latest entry per key).

Examples

1
2
3
4
5
6
7
8
country <- rr_register("country")
snapshot <- rr_snapshot(country)

nrow(country$data)
nrow(snapshot$data)

country$schema$custodian
snapshot$schema$custodian

openregister/RegistersClientR documentation built on May 23, 2019, 9:03 p.m.