Skip to content

Commit 4703684

Browse files
authored
Merge pull request #185 from cmu-delphi/104-find-the-sources-of-the-conflicts-with-most-recent-version-of-epiprocess
Addressed the sources of the conflicts between epipredict and epiprocess (see Issue 104 in epipredict)
2 parents becfee9 + d1b23ce commit 4703684

7 files changed

+47
-90
lines changed

R/methods-epi_df.R

+5-32
Original file line numberDiff line numberDiff line change
@@ -69,51 +69,24 @@ summary.epi_df = function(object, ...) {
6969

7070
if (!is.data.frame(res)) return(res)
7171

72-
i_arg <- substitute(i)
73-
j_arg <- substitute(j)
74-
7572
if (missing(i)) {
7673
i <- NULL
7774
i_arg <- NULL
78-
} else if (is.null(i)) {
79-
i <- integer()
80-
}
75+
}
8176

8277
if (missing(j)) {
8378
j <- NULL
8479
j_arg <- NULL
85-
} else if (is.null(j)) {
86-
j <- integer()
87-
}
88-
89-
# Ignore drop as an argument for counting
90-
n_real_args <- nargs() - !missing(drop)
91-
92-
# Case when the number of args (excluding drop) is not 3 or more
93-
if (n_real_args <= 2L) {
94-
j <- i
95-
i <- NULL
96-
j_arg <- i_arg
97-
i_arg <- NULL
98-
}
80+
}
9981

10082
cn <- names(res)
10183
nr <- vctrs::vec_size(x)
10284
not_epi_df <- (!("time_value" %in% cn) || !("geo_value" %in% cn) || vctrs::vec_size(res) > nr || any(i > nr))
103-
104-
if (not_epi_df) return(tibble::as_tibble(res))
10585

106-
# Case when i is numeric and there are duplicate values in it
107-
if (is.numeric(i) && vctrs::vec_duplicate_any(i) > 0)
108-
return(tibble::as_tibble(res))
86+
if (not_epi_df) return(tibble::as_tibble(res))
10987

110-
att_x = attr(x, "metadata")
111-
new_epi_df(tibble::as_tibble(res),
112-
geo_type = att_x$geo_type,
113-
time_type = att_x$time_type,
114-
as_of = att_x$as_of,
115-
additional_metadata =
116-
att_x[!(names(att_x) %in% c("geo_type", "time_type", "as_of"))])
88+
# Use reclass as safeguard (in case class & metadata are dropped)
89+
reclass(res, attr(x, "metadata"))
11790
}
11891

11992
#' `dplyr` verbs

man/as_epi_archive.Rd

+4-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/as_epi_df.Rd

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epi_archive.Rd

+21-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epi_slide.Rd

+4-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epix_as_of.Rd

+4-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epix_slide.Rd

+4-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)