Skip to content

Commit

Permalink
Merge pull request #8 from reconhub/inherit-get_dates
Browse files Browse the repository at this point in the history
import get_dates from incidence
  • Loading branch information
zkamvar authored Aug 24, 2018
2 parents e19b3f1 + 9f25390 commit 065c73f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 40 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Encoding: UTF-8
LazyData: true
Suggests: testthat, vdiffr, roxygen2, knitr, rmarkdown, outbreaks, magrittr
Imports: stats, utils, incidence, distcrete, ggplot2
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0
Remotes: reconhub/incidence
URL: http://www.repidemicsconsortium.org/projections
BugReports: http://github.com/reconhub/projections/issues
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ S3method("[",projections)
S3method(as.data.frame,projections)
S3method(as.matrix,projections)
S3method(cumulate,projections)
S3method(get_dates,default)
S3method(get_dates,projections)
S3method(plot,projections)
S3method(print,projections)
Expand All @@ -15,4 +14,5 @@ export(get_dates)
export(project)
importFrom(graphics,plot)
importFrom(incidence,cumulate)
importFrom(incidence,get_dates)
importFrom(stats,as.ts)
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# projections 0.3.1

- `get_dates()` now inherits the generic `get_dates()` from incidence

# projections 0.3.0

## New features
Expand Down
31 changes: 7 additions & 24 deletions R/accessors.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
#' \item \code{get_dates}: get dates of the predictions.
#'
#' }
#'
#' @name get_dates
#' @rdname projections_accessors
#'
#' @author Thibaut Jombart \email{thibautjombart@@gmail.com}
#'
#' @export
#'
#' @param x A \code{projections} object.
#'
Expand All @@ -21,7 +20,7 @@
#' @examples
#'
#'
#' if (require(distcrete) && require(incidence)) {
#' if (require(distcrete) && require(incidence)) { withAutoprint({
#'
#' ## prepare input: epicurve and serial interval
#' dat <- c(0, 2, 2, 3, 3, 5, 5, 5, 6, 6, 6, 6)
Expand All @@ -40,28 +39,12 @@
#' get_dates(pred_1)
#' max(i$dates) # predictions start 1 day after last incidence
#'
#' }
#'

get_dates <- function(x, ...) {
UseMethod("get_dates", x)
}


#' @rdname projections_accessors
#' @export
#' @aliases get_dates.default

get_dates.default <- function(x, ...) {
stop(sprintf("Not implemented for class %s",
paste(class(x), collapse = ", ")))
}


#' @rdname projections_accessors
#' @export
#' })}
#' @aliases get_dates.projections

#' @aliases get_dates
#' @importFrom incidence get_dates
#' @export get_dates
#' @export
get_dates.projections <- function(x, ...) {
attr(x, "dates")
}
Expand Down
10 changes: 5 additions & 5 deletions man/plot.projections.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions man/projections_accessors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/subset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 065c73f

Please sign in to comment.