Skip to content

Commit 4b7205c

Browse files
authored
Merge pull request #77 from cmu-delphi/ds/docs
Another documentation pass
2 parents f7996dd + bb2e224 commit 4b7205c

File tree

8 files changed

+325
-235
lines changed

8 files changed

+325
-235
lines changed

.Rbuildignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@
1515
^\.editorconfig$
1616
^\.lintr$
1717
^Makefile$
18-
18+
^venv$
19+
^.venv$
20+
^env$
21+
^.env$

.gitignore

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
docs
77
inst/doc
88
/check
9-
.Rdata
10-
.httr-oauth
119
.DS_Store
10+
venv
11+
env
12+
.venv
13+
.env
14+
.Rdata
15+
.httr-oauth

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Imports:
2525
readr,
2626
MMWRweek,
2727
rlang
28-
RoxygenNote: 7.2.1
28+
RoxygenNote: 7.2.3
2929
Suggests:
3030
knitr,
3131
magrittr,

R/endpoints.R

+298-227
Large diffs are not rendered by default.

R/epidatacall.R

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#' an abstraction that holds the information needed to make an epidata call
2+
#'
3+
#' @param endpoint the epidata endpoint to call
4+
#' @param params the parameters to pass to the epidata endpoint
5+
#' @param meta meta data to attach to the epidata call
6+
#' @param only_supports_classic if true only classic format is supported
7+
#'
8+
#' @return an epidata_call instance
9+
#'
110
create_epidata_call <- function(endpoint, params, meta = NULL,
211
only_supports_classic = FALSE) {
312
stopifnot(is.character(endpoint), length(endpoint) == 1)

R/model.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' builds a new EpiRange instances
22
#'
3-
#' @param from A string or numeric that takes the form YYYYMMDD.
4-
#' @param to A string or numeric that takes the form YYYYMMDD.
3+
#' @param from A string or numeric that takes the form YYYYMMDD for dates or YYYYMM for epiweeks.
4+
#' @param to A string or numeric that takes the form YYYYMMDD for dates or YYYYMM for epiweeks.
55
#' @return EpiRange instance
66
#'
77
#' @export

R/utils.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ format_item <- function(value) {
66
"from" %in% names(value) && "to" %in% names(value) && length(names(value)) == 2) {
77
paste0(toString(value$from), "-", toString(value$to))
88
} else {
9-
toString(value)
9+
paste(value, collapse = ",")
1010
}
1111
}
1212

@@ -16,5 +16,5 @@ format_list <- function(values) {
1616
("from" %in% names(values) && "to" %in% names(values))) {
1717
values <- list(values)
1818
}
19-
paste(sapply(values, format_item), collapse = ",")
19+
paste(vapply(values, format_item, character(1L)), collapse = ",")
2020
}

tests/testthat/test-utils.R

+3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ test_that("format_list", {
88
expect_equal(format_list(5), "5")
99
expect_equal(format_list("5"), "5")
1010
expect_equal(format_list(list(from = 2, to = 5)), "2-5")
11+
expect_equal(format_list(list(list(from = 2, to = 6))), "2-6")
1112
expect_equal(format_list(epirange(2, 8)), "2-8")
13+
expect_equal(format_list(list(epirange(2, 9))), "2-9")
1214
expect_equal(format_list(list("5", "4")), "5,4")
1315
expect_equal(format_list(list(3, list(from = 2, to = 5))), "3,2-5")
16+
expect_equal(format_list(list(c(3, 8), list(from = 2, to = 5))), "3,8,2-5")
1417
})

0 commit comments

Comments
 (0)