Reputation: 14751
I have an ets object (obtained with the ets()
function from forecast) and want to plot it.
fit <- ets (myTimeSeries) # myTimeSeries obtained via ts()
plot (fit) # works fine
plot (fit, main="my title") # fails with error
The error is:
Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, :
formal argument "main" matched by multiple actual arguments
I don't understand what I need to do, the attribute is shown in the help.
My loaded packages (in case there is a conflict about which plot() implementation is called):
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.20-29 forecast_5.4 timeDate_3010.98 zoo_1.7-11 ggplot2_0.9.3.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.4 fracdiff_1.4-2 grid_3.1.0 gtable_0.1.2
[6] labeling_0.2 MASS_7.3-31 munsell_0.4.2 nnet_7.3-8 parallel_3.1.0
[11] plyr_1.8.1 proto_0.3-10 quadprog_1.5-5 Rcpp_0.11.1 reshape2_1.4
[16] scales_0.2.4 stringr_0.6.2 tools_3.1.0 tseries_0.10-32
Upvotes: 0
Views: 702
Reputation: 26
Here's an option that would work if you really did want to add a title to a plot of the fit function specified in the question (tested with the USAccDeaths data):
> plot.ts(cbind(observed = myTimeSeries, level = fit$states[, 1], season = fit$states[, "s1"]), main = "New Title")
Upvotes: 1