Right, I didn't realize the trace argument was behaving that way. I'm not sure it's totally good practice, but you could always capture the cat() output from trace and then process it into a data frame:
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
library(tidyverse)
set.seed(123)
z <- ts(rnorm(120, 30, 17), start=2008, frequency=12)
mod_capt <- capture.output(auto.arima(z, trace = TRUE))
mod_capt[seq(2,which(mod_capt == "")[2]-1)] %>%
enframe(value = "raw_capture") %>%
extract(raw_capture,
into = c("model","mean","res"),
regex = "^ (ARIMA[(),\\d\\[\\]]+)[[:blank:]]+with (non-zero|zero) mean +:[[:blank:]]+([\\d.]+)$")
#> # A tibble: 11 x 4
#> name model mean res
#> <int> <chr> <chr> <chr>
#> 1 1 ARIMA(2,0,2)(1,0,1)[12] non-zero 1003.345
#> 2 2 ARIMA(0,0,0) non-zero 996.8378
#> 3 3 ARIMA(1,0,0)(1,0,0)[12] non-zero 999.0416
#> 4 4 ARIMA(0,0,1)(0,0,1)[12] non-zero 999.1399
#> 5 5 ARIMA(0,0,0) zero 1187.768
#> 6 6 ARIMA(0,0,0)(1,0,0)[12] non-zero 996.902
#> 7 7 ARIMA(0,0,0)(0,0,1)[12] non-zero 997
#> 8 8 ARIMA(0,0,0)(1,0,1)[12] non-zero 999.0153
#> 9 9 ARIMA(1,0,0) non-zero 998.9257
#> 10 10 ARIMA(0,0,1) non-zero 998.9227
#> 11 11 ARIMA(1,0,1) non-zero 996.8584
Created on 2020-11-25 by the reprex package (v0.3.0)