Skip to content

messy Rd for VARIMA #432

@MichaelChirico

Description

@MichaelChirico

fable/man/VARIMA.Rd

Lines 148 to 187 in 70e55ac

\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
library(tsibbledata)
aus_production \%>\%
autoplot(vars(Beer, Cement))
fit <- aus_production \%>\%
model(VARIMA(vars(Beer, Cement) ~ pdq(4,1,1), identification = "none"))
fit
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
fit \%>\%
forecast(h = 50) \%>\%
autoplot(tail(aus_production, 100))
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
fitted(fit)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
residuals(fit)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
tidy(fit)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
glance(fit)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
report(fit)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
generate(fit, h = 10)
\dontshow{\}) # examplesIf}
\dontshow{if (requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
IRF(fit, h = 10, impulse = "Beer")
\dontshow{\}) # examplesIf}
}

IINM this is due to stitching together @examples from various different sources.

I'm not sure the best approach here -- one idea is to just have all the examples in one place:

fable/R/VARIMA.R

Lines 171 to 182 in 70e55ac

#' @examplesIf requireNamespace("tsibbledata", quietly = TRUE)
#' library(tsibbledata)
#'
#' aus_production %>%
#' autoplot(vars(Beer, Cement))
#'
#' fit <- aus_production %>%
#' model(VARIMA(vars(Beer, Cement) ~ pdq(4,1,1), identification = "none"))
#'
#' fit
#' @export
VARIMA <- function(formula, identification = NULL, ...) {

But I understand the appeal of having the example live near the function it's for, e.g.

fable/R/VARIMA.R

Lines 198 to 205 in 70e55ac

#' @rdname VARIMA
#' @inheritParams forecast.VAR
#' @examplesIf requireNamespace("tsibbledata", quietly = TRUE)
#'
#' fit %>%
#' forecast(h = 50) %>%
#' autoplot(tail(aus_production, 100))
#' @export

OTOH, part of the idea of {roxygen2} is to just never look at Rd files again, so maybe I'm just silly for doing so :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions