diff --git a/NAMESPACE b/NAMESPACE index 5f66d70..200bb52 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -88,7 +88,6 @@ export(infer) export(rbind_ts) export(unscale) import(dplyr) -import(forecast) import(ggplot2) import(scales) import(tidyr) diff --git a/R/base_fortify_list.R b/R/base_fortify_list.R index fa95912..dc6d043 100644 --- a/R/base_fortify_list.R +++ b/R/base_fortify_list.R @@ -18,7 +18,7 @@ fortify.list <- function(data) { #' Autoplot list. #' #' @param data \code{list} instance -#' @param ... Keywords passed to autoplot +#' @param ... Keywords passed to inferred autoplot #' @return ggplot #' @export autoplot.list <- function(data, ...) { diff --git a/R/base_fortify_ts.R b/R/base_fortify_ts.R index cc0c2ae..933429b 100644 --- a/R/base_fortify_ts.R +++ b/R/base_fortify_ts.R @@ -104,7 +104,7 @@ fortify.irts <- fortify.ts #' @param facets Logical value to specify use facets for multivariate time-series #' @param nrow Number of facet/subplot rows #' @param ncol Number of facet/subplot columns -#' @param ts.geom Geometric string for time-series plotting. 'line' or 'bar'. +#' @param ts.geom Geometric string for time-series plotting. 'line', 'bar' or 'point'. #' @param ts.colour Line colour for time-series #' @param ts.linetype Line type for time-series #' @param xlab Character vector or expression for x axis label @@ -181,6 +181,8 @@ autoplot.ts <- function(data, columns = NULL, group = NULL, geomobj <- ggplot2::geom_line } else if (ts.geom == 'bar') { geomobj <- ggplot2::geom_bar + } else if (ts.geom == 'point') { + geomobj <- ggplot2::geom_point } else { stop("Invalid geom is specified. Use 'line' or 'bar'.") } @@ -457,4 +459,4 @@ autoplot.fGARCH <- autoplot.tsmodel autoplot.dlmFiltered <- autoplot.tsmodel #' @export -autoplot.KFS <- autoplot.tsmodel \ No newline at end of file +autoplot.KFS <- autoplot.tsmodel diff --git a/R/ggfortify.R b/R/ggfortify.R index 63e2125..f648fcc 100644 --- a/R/ggfortify.R +++ b/R/ggfortify.R @@ -4,5 +4,5 @@ #' #' @name ggfortify #' @docType package -#' @import zoo forecast scales ggplot2 dplyr tidyr +#' @import zoo scales ggplot2 dplyr tidyr NULL \ No newline at end of file diff --git a/R/plotlib.R b/R/plotlib.R index 60b9196..0fc5da2 100644 --- a/R/plotlib.R +++ b/R/plotlib.R @@ -87,7 +87,8 @@ setClass('ggmultiplot', #' Generic add operator for \code{ggmultiplot} #' #' @param object \code{ggmultiplot} -#' @param g +#' @param e1 first argument +#' @param e2 second argument #' @return \code{ggmultiplot} setMethod('+', c('ggmultiplot', 'ANY'), function(e1, e2) { @@ -141,14 +142,15 @@ print.ggmultiplot <- function(p) { } else { require(grid) layout <- get.layout(nplots, p@ncol, p@nrow) - grid.newpage() - pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout)))) + grid::grid.newpage() + vp <- grid::viewport(layout = grid.layout(nrow(layout), ncol(layout))) + grid::pushViewport(vp) for (i in 1:nplots) { matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE)) - - print(p@plots[[i]], vp = viewport(layout.pos.row = matchidx$row, - layout.pos.col = matchidx$col)) + vp <- grid::viewport(layout.pos.row = matchidx$row, + layout.pos.col = matchidx$col) + print(p@plots[[i]], vp = vp) } } } diff --git a/R/tslib.R b/R/tslib.R index bd83bdd..62b4203 100644 --- a/R/tslib.R +++ b/R/tslib.R @@ -174,6 +174,7 @@ confint.acf <- function (x, ci = 0.95, ci.type = "white") { #' Calcurate fitted values for \code{stats::ar} #' #' @param object \code{stats::ar} instance +#' @param ... other keywords #' @return ts An time series of the one-step forecasts #' @examples #' fitted(ar(WWWusage)) @@ -181,15 +182,13 @@ confint.acf <- function (x, ci = 0.95, ci.type = "white") { fitted.ar <- function(object, ...) { library(forecast) x <- forecast::getResponse(object) - # if (is.null(x)) { - # return(NULL) - # } return(x - residuals(object)) } #' Calcurate residuals for \code{stats::ar} #' #' @param object \code{stats::ar} instance +#' @param ... other keywords #' @return ts Residuals extracted from the object object. #' @examples #' residuals(ar(WWWusage)) @@ -267,7 +266,8 @@ ggcpgram <- function (ts, taper = 0.1, #' @param ad.linetype Line type for additional lines #' @param ad.size Fill colour for additional lines #' @param nrow Number of facet/subplot rows -#' @param ncol Number of facet/subplot columns +#' @param ncol Number of facet/subplot columns +#' @param ... other keywords #' @return ggplot #' @examples #' library(ggplot2) diff --git a/man/autoplot.list.Rd b/man/autoplot.list.Rd index c7e2d39..73e1847 100644 --- a/man/autoplot.list.Rd +++ b/man/autoplot.list.Rd @@ -9,7 +9,7 @@ \arguments{ \item{data}{\code{list} instance} -\item{...}{Keywords passed to autoplot} +\item{...}{Keywords passed to inferred autoplot} } \value{ ggplot diff --git a/man/autoplot.ts.Rd b/man/autoplot.ts.Rd index af49d82..ec6e550 100644 --- a/man/autoplot.ts.Rd +++ b/man/autoplot.ts.Rd @@ -39,7 +39,7 @@ If not provided, regard the input as date when the frequency is 4 or 12.} \item{ncol}{Number of facet/subplot columns} -\item{ts.geom}{Geometric string for time-series plotting. 'line' or 'bar'.} +\item{ts.geom}{Geometric string for time-series plotting. 'line', 'bar' or 'point'.} \item{ts.colour}{Line colour for time-series} diff --git a/man/fitted.ar.Rd b/man/fitted.ar.Rd index 7cbea51..d9f7c2a 100644 --- a/man/fitted.ar.Rd +++ b/man/fitted.ar.Rd @@ -8,6 +8,8 @@ } \arguments{ \item{object}{\code{stats::ar} instance} + +\item{...}{other keywords} } \value{ ts An time series of the one-step forecasts diff --git a/man/ggtsdiag.Rd b/man/ggtsdiag.Rd index d323ebc..6c5f4a6 100644 --- a/man/ggtsdiag.Rd +++ b/man/ggtsdiag.Rd @@ -33,6 +33,8 @@ ggtsdiag(object, gof.lag = 10, conf.int = TRUE, \item{nrow}{Number of facet/subplot rows} \item{ncol}{Number of facet/subplot columns} + +\item{...}{other keywords} } \value{ ggplot diff --git a/man/plus-ggmultiplot-ANY-method.Rd b/man/plus-ggmultiplot-ANY-method.Rd index 77de334..432e1f8 100644 --- a/man/plus-ggmultiplot-ANY-method.Rd +++ b/man/plus-ggmultiplot-ANY-method.Rd @@ -8,9 +8,11 @@ \S4method{+}{ggmultiplot,ANY}(e1, e2) } \arguments{ -\item{object}{\code{ggmultiplot}} +\item{e1}{first argument} + +\item{e2}{second argument} -\item{g}{} +\item{object}{\code{ggmultiplot}} } \value{ \code{ggmultiplot} diff --git a/man/residuals.ar.Rd b/man/residuals.ar.Rd index fd1fde6..08a86bb 100644 --- a/man/residuals.ar.Rd +++ b/man/residuals.ar.Rd @@ -8,6 +8,8 @@ } \arguments{ \item{object}{\code{stats::ar} instance} + +\item{...}{other keywords} } \value{ ts Residuals extracted from the object object.