Hello,
Is this what you want?
fun <- function(x, a){
y <- as.numeric(as.character(x))
z <- paste(a, names(x))
data.frame(z, y)
}
dat2 <- as.data.frame(TSmodelForecast)
tmp <- lapply(seq_along(dat2), function(i) fun(dat2[[i]], names(dat2)[i]))
result <- do.call(rbind, t
Hi Paul,
A more educated guess is:
print(data.frame(Date=paste(rep(month.abb,32),
rep(1986:2017,each=12), sep="-")[-(378:384)],
Forecast=mf5$x))
Someone else may be able to tell you how to extract the dates from the
time series object mf5$x
Jim
On Sat, Mar 18, 2017 at 8:23 AM, Paul Bernal w
Hello,
By running the code of the OP, I've come to the conclusion that
print.forecast calls print.data.frame:
forecast:::print.forecast
function (x, ...)
{
print(as.data.frame(x))
}
But I'm unable to get what the OP wants by call as.data.frame(...).
Here is the code with some made up da
Dear Jim,
Thank you for your valuable replies. So variable mf5 has the forecasts for
a fitted nnetar model.
Below is the class and the str(mf5) output. Maybe with this information I
am sharing with you, hopefully you can give me some more guidance.
Again, thank you so much!
> class(mf5)
[1] "fo
Hi Paul,
When manipulating any R object, the first thing to ascertain is what it is:
class(TSmodelForecast)
should give you useful information.
str(TSmodelForecast)
should give you more. Because of the wealth of defined data structures
in R, it is difficult to manipulate them without this infor
Hi Paul,
It looks like the information that is printed is in:
TSModelForecast$mean
If str(TSModelForecast$mean) returns something like a list with two
components, you can probably use something like this:
paste(format(TSModelForecast$mean$Date,"%b-%Y"),
TSModelForecast$mean$Forecast,sep="-",col
Dear friends,
I am currently using R version 3.3.3 (64-bit) and used the following code
to generate forecasts:
> library(forecast)
>
> library(tseries)
‘tseries’ version: 0.10-35
‘tseries’ is a package for time series analysis and computational
finance.
See ‘library(help="tseries")
7 matches
Mail list logo