你可以用其中一个
par(mfrow = c(3, 3))
map2(forecasts, names(forecasts),
~ plot( .x,
main = .y,
bty = "n",
ylab = "Monthly Revenue",
xlab = "Time"))
# same as map2 but returns nothing
# suitable for plotting & writing output to files
walk2(forecasts, names(forecasts),
~ plot( .x,
main = .y,
bty = "n",
ylab = "Monthly Revenue",
xlab = "Time"))
pwalk(list(forecasts, names(forecasts)),
~ plot( ..1,
main = ..2,
bty = "n",
ylab = "GDP",
xlab = "Year"))
# to save some typing
iwalk(forecasts,
~ plot( .x,
main = .y,
bty = "n",
ylab = "Monthly Revenue",
xlab = "Time"))
附笔:
time_series
在您的函数中不需要,因为您在后面的函数中不使用它
plot
呼叫