Convert <model> to character(or something else)

I am trying to copy the following output as a tibble/df; but getting error when I use View(). I believe it is due to the <model> object -- the variable ARIMA(Trips) . I tried mutating it as character but failed. How do I make the <model> object as character? The goal is to obtain the model specification along with relevant data and join them with another data frame.

# library
suppressWarnings(suppressMessages(library(fpp3)))
# Data & Model
tourism %>% 
  filter(Region %in% c("Melbourne", "Sydney"),
         Purpose == "Holiday") %>% 
  model(ARIMA(Trips))
#> # A mable: 2 x 4
#> # Key:     Region, State, Purpose [2]
#>   Region    State           Purpose                   `ARIMA(Trips)`
#>   <chr>     <chr>           <chr>                            <model>
#> 1 Melbourne Victoria        Holiday          <ARIMA(0,1,1) w/ drift>
#> 2 Sydney    New South Wales Holiday <ARIMA(1,0,0)(1,0,1)[4] w/ mean>

Created on 2020-09-26 by the reprex package (v0.3.0)

The output is already a tibble, as well as a mable

suppressWarnings(suppressMessages(library(fpp3)))
# Data & Model
tourism %>% 
  filter(Region %in% c("Melbourne", "Sydney"),
         Purpose == "Holiday") %>% 
  model(ARIMA(Trips)) -> result

class(result)
#> [1] "mdl_df"     "tbl_df"     "tbl"        "data.frame"

Created on 2020-09-26 by the reprex package (v0.3.0.9001)

If the questions is how can it be formatted for display?

suppressWarnings(suppressMessages(library(fpp3)))
# Data & Model
tourism %>% 
  filter(Region %in% c("Melbourne", "Sydney"),
         Purpose == "Holiday") %>% 
  model(ARIMA(Trips)) -> result

pander::pander(result)
Region State Purpose ARIMA(Trips)
Melbourne Victoria Holiday <ARIMA(0,1,1) w/ drift>
Sydney New South Wales Holiday <ARIMA(1,0,0)(1,0,1)[4] w/ mean>

Created on 2020-09-26 by the reprex package (v0.3.0.9001)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Thanks for the feedback.

I just used another computer with freshly installed packages; I do not face the issue that I mentioned earlier! Seems like I need to reinstall the packages.

1 Like