I am new to tidymodels
& fairly new to R as well.
I created a recipe using tidymodels
which worked well on train data but is giving an error on cross validated resamples.
So I would like to view the resamples but they are not in simple df format.
train_5fold
############ result ###########
splits id
<list> <chr>
<S3: vfold_split> Fold1
<S3: vfold_split> Fold2
<S3: vfold_split> Fold3
<S3: vfold_split> Fold4
<S3: vfold_split> Fold5
download data
https://github.com/johnsnow09/covid19-df_stack-code/blob/main/train_5fold.RDS
train_5fold <- readRDS("train_5fold.RDS")
How can I view them ??
I have tried pluck(), unnest_wider, unlist etc but not been able to get the real data frame.
I have also posted another SO post on tidymodels which remains unanswered till now so trying to debug by cross checking CV data
Getting error when trying to apply tidymodels recipe from train data to resamples in r?
You can get the data from each splits
with lapply
as -
df <- readRDS('train_5fold.RDS')
list_df <- lapply(df$splits, `[[`, 'data')
If you want to combine them in one dataframe use res <- do.call(rbind, list_df)
Or with purrr
-
library(purrr)
res <- map_df(df$splits, pluck, 'data')