While using rsample, tidymodels, I create the resamples with the following code (see below). Though I don't want to assess the model with all horizon positions, in the presented case from 1 to 5. Let's say I want to assess the model only for 4 and 5 horizon positions. My real life problem is somewhat like this. So I don't want my model to be tuned with errors for all horizon positions.
So my option was to use rsample::rolling_origin() and then subset the assessment index. I can do it with a for loop... but I got curious about using another way. I would like to do it with purrr. I know I should probably move one since it is working like it is... but it's killing me.
How do I refer to a third inner level, using purrr's functions?
require(tidyverse)
require(tidymodels)
data(cars)
roll_rs <-rolling_origin(
data=cars,
initial = floor(0.80*(nrow(cars))),
assess = 5,
skip = 0,
cumulative = TRUE )
new_roll_rs<-roll_rs
for (i in 1:13){
new_roll_rs[[1]][[i]][["out_id"]]<-roll_rs[[1]][[i]][["out_id"]][4:5]
}
Thanks