Skip to content

Commit b4aa672

Browse files
dajmcdondshemetov
authored andcommitted
other_keys is character()
1 parent 3c3bc6f commit b4aa672

File tree

7 files changed

+33
-15
lines changed

7 files changed

+33
-15
lines changed

DESCRIPTION

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,22 @@ Encoding: UTF-8
7373
LazyData: true
7474
Roxygen: list(markdown = TRUE)
7575
RoxygenNote: 7.3.2
76+
Collate:
77+
'archive.R'
78+
'autoplot.R'
79+
'correlation.R'
80+
'data.R'
81+
'epi_df.R'
82+
'epiprocess.R'
83+
'group_by_epi_df_methods.R'
84+
'methods-epi_archive.R'
85+
'grouped_epi_archive.R'
86+
'growth_rate.R'
87+
'key_colnames.R'
88+
'methods-epi_df.R'
89+
'outliers.R'
90+
'reexports.R'
91+
'revision_analysis.R'
92+
'slide.R'
93+
'utils.R'
94+
'utils_pipe.R'

R/archive.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ as_epi_archive <- function(
479479
x,
480480
geo_type = deprecated(),
481481
time_type = deprecated(),
482-
other_keys = character(0L),
482+
other_keys = character(),
483483
compactify = NULL,
484484
clobberable_versions_start = NA,
485485
.versions_end = max_version_with_row_in(x), ...,

R/epi_df.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ NULL
171171
#'
172172
#' @export
173173
new_epi_df <- function(x = tibble::tibble(), geo_type, time_type, as_of,
174-
other_keys = character(0L), ...) {
174+
other_keys = character(), ...) {
175175
# Define metadata fields
176176
metadata <- list()
177177
metadata$geo_type <- geo_type
@@ -223,7 +223,7 @@ as_epi_df.tbl_df <- function(
223223
geo_type = deprecated(),
224224
time_type = deprecated(),
225225
as_of,
226-
other_keys = NULL,
226+
other_keys = character(),
227227
...) {
228228
# possible standard substitutions for time_value
229229
x <- rename(x, ...)
@@ -269,23 +269,23 @@ as_epi_df.tbl_df <- function(
269269
} # Use the current day-time
270270
}
271271

272-
assert_character(other_keys, null.ok = TRUE)
272+
assert_character(other_keys)
273273
new_epi_df(x, geo_type, time_type, as_of, other_keys)
274274
}
275275

276276
#' @method as_epi_df data.frame
277277
#' @rdname epi_df
278278
#' @export
279-
as_epi_df.data.frame <- function(x, as_of, other_keys = NULL, ...) {
279+
as_epi_df.data.frame <- function(x, as_of, other_keys = character(), ...) {
280280
as_epi_df.tbl_df(x = tibble::as_tibble(x), as_of = as_of, other_keys = other_keys, ...)
281281
}
282282

283283
#' @method as_epi_df tbl_ts
284284
#' @rdname epi_df
285285
#' @export
286-
as_epi_df.tbl_ts <- function(x, as_of, other_keys = NULL, ...) {
286+
as_epi_df.tbl_ts <- function(x, as_of, other_keys = character(), ...) {
287287
tsibble_other_keys <- setdiff(tsibble::key_vars(x), "geo_value")
288-
if (length(tsibble_other_keys) != 0) {
288+
if (length(tsibble_other_keys) > 0) {
289289
other_keys <- unique(c(other_keys, tsibble_other_keys))
290290
}
291291
as_epi_df.tbl_df(x = tibble::as_tibble(x), as_of = as_of, other_keys = other_keys, ...)

R/methods-epi_archive.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ epix_as_of <- function(x, max_version, min_time_value = -Inf, all_versions = FAL
6565
key(x$DT),
6666
c("geo_value", "time_value", "version")
6767
)
68-
if (length(other_keys) == 0) other_keys <- NULL
6968

7069
# Check a few things on max_version
7170
if (!identical(class(max_version), class(x$DT$version))) {

R/methods-epi_df.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ print.epi_df <- function(x, ...) {
6464
cat(sprintf("* %-9s = %s\n", "geo_type", attributes(x)$metadata$geo_type))
6565
cat(sprintf("* %-9s = %s\n", "time_type", attributes(x)$metadata$time_type))
6666
ok <- attributes(x)$metadata$other_keys
67-
if (!is.null(ok)) {
67+
if (length(ok) > 0) {
6868
cat(sprintf("* %-9s = %s\n", "other_keys", paste(ok, collapse = ", ")))
6969
}
7070
cat(sprintf("* %-9s = %s\n", "as_of", attributes(x)$metadata$as_of))
@@ -91,7 +91,7 @@ summary.epi_df <- function(object, ...) {
9191
cat("An `epi_df` x, with metadata:\n")
9292
cat(sprintf("* %-9s = %s\n", "geo_type", attributes(object)$metadata$geo_type))
9393
ok <- attributes(object)$metadata$other_keys
94-
if (!is.null(ok)) {
94+
if (length(ok) > 0) {
9595
cat(sprintf("* %-9s = %s\n", "other_keys", paste(ok, collapse = ", ")))
9696
}
9797
cat(sprintf("* %-9s = %s\n", "as_of", attributes(object)$metadata$as_of))

man/epi_archive.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epi_df.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)