Description Usage Arguments Details Value Examples
Filters for entries up to a given entry-number
or timestamp
,
then returns the latest entry per key
.
Use rr_snapshot()
for a snapshot of a whole register (both schema and
data).
1 2 | rr_records(entries, sequence = c("entry-number", "timestamp"),
maximum = NULL, include_maximum = TRUE)
|
entries |
A data frame or tibble with at least the fields |
sequence |
One of |
maximum |
An |
include_maximum |
Logical, whether to include entries whose
|
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.
A tibble of records (latest entry per key).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | country <- rr_register("country")
# There can be more than one entry per key
country$data %>%
dplyr::filter(key == "CZ") %>%
dplyr::select(`entry-number`, timestamp, name, `official-name`)
# Snapshot by entry number
country$data %>%
rr_records(maximum = 64) %>%
dplyr::filter(key == "CZ") %>%
dplyr::select(`entry-number`, timestamp, name, `official-name`)
country$data %>%
rr_records(maximum = 217, include_maximum = FALSE) %>%
dplyr::filter(key == "CZ") %>%
dplyr::select(`entry-number`, timestamp, name, `official-name`)
# Snapshot by entry timestamp
country$data %>%
rr_records(sequence = "timestamp",
maximum = as.POSIXct("2016-04-05 13:23:05", tz = "UTC")) %>%
dplyr::filter(key == "CZ") %>%
dplyr::select(`entry-number`, timestamp, name, `official-name`)
# When the timestamp of any entry of a key is missing, no entries are
# returned.
entries <- country$data
entries$timestamp[entries$`entry-number` == 64] <- NA
rr_records(entries, sequence = "timestamp") %>%
dplyr::filter(key == "CZ")
# Not all entries are data, some are schema
country$schema$custodians %>%
rr_records(maximum = 11) %>%
dplyr::select(`entry-number`, timestamp, custodian)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.