[R] [FORGED] Export Forecasted output to a table (excel)
marc_schwartz at me.com
Thu Feb 2 00:06:40 CET 2017
> On Feb 1, 2017, at 4:30 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>> On Feb 1, 2017, at 2:25 PM, Daniel Nordlund <djnordlund at gmail.com> wrote:
>> On 2/1/2017 2:05 PM, Rolf Turner wrote:
>>> On 02/02/17 08:03, Lal Prasad wrote:
>>>> Hi All,
>>>> Is there any way to
>>>> 1) Convert the below forecast to a datafram
>>>> 2) Any way to write it to an excel table?
>>>> library(fpp)VARselect(usconsumption, lag.max = 3,
>>>> type="const")$selectionvar <- VAR(usconsumption, p=1,type =
>>>> "both",lag.max = 3)
>>>> serial.test(var, lags.pt = 3,type = "PT.asymptotic")
>>>> fcst <- forecast(var)
>>> (1) Read the posting guide.
>>> (2) In particular don't post in HTML.
>>> (3) As it appears, your code makes no sense to me.
>>> (4) DON'T use Excel. Ever. See:
>>> Rolf Turner
>> Unfortunately, that link appears to be broken / does not exist anymore.
> A google-search quickly turned up this:
The original 2001 JSM presentation by Jon Cryer is available here:
It would appear that he has retired from Iowa and may no longer have an online directory.
Patrick Burns also has a very good presentation and a reference listing here:
as does Frank:
FWIW, in the context of a nuanced response and differentiating between using Excel for any actual analyses, which is largely what the above references are warning against and simply for narrowly exporting R results, there are various packages available that can facilitate that, presuming you solve the underlying issue of getting the data into a compatible format (e.g. data frame).
The R Data Import/Export Manual is helpful here:
The use of the ?str function can help provide insights into the structure of the returned object and how you might access selected components of the structure to achieve your goal.
An alternative to using Excel would be to use something like the Knitr package, which supports the use of markdown and can facilitate exporting formatted tables, etc. to HTML, PDF and so forth:
>> Daniel Nordlund
>> Port Townsend, WA USA
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> David Winsemius
> Alameda, CA, USA
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help