问题
I have a mable object that is like so:
models
# A mable: 1 x 3
ets arima nnetar
<model> <model> <model>
1 <ETS(M,Ad,M)> <ARIMA(2,1,2)(0,0,2)[12]> <NNAR(14,1,10)[12]>
I just want the models descriptions so I can place them in a plot. So I ran the following code:
model_desc <- models %>%
gather() %>%
select(key, value) %>%
set_names("model","model_desc") %>%
mutate(model_desc_char = model_desc %>% as.character())
as_tibble() %>%
select(model, model_desc)
This still gives me back a tibble where model_desc is still a list object. I think this is because of how a mable is constructed and how its structure is supposed to be.
** UPDATE ** I solved the problem by doing the following:
model_desc <- models %>%
as_tibble() %>%
gather() %>%
mutate(model_desc = print(value)) %>%
select(key, model_desc) %>%
set_names("model", "model_desc")
回答1:
This ended up solving my issue:
model_desc <- models %>%
as_tibble() %>%
gather() %>%
mutate(model_desc = print(value)) %>%
select(key, model_desc) %>%
set_names("model", "model_desc")
来源:https://stackoverflow.com/questions/59721759/extract-model-description-from-a-mable