Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.data.frame.rsplit

Convert an rsplit object to a data frame


Description

The analysis or assessment code can be returned as a data frame (as dictated by the data argument) using as.data.frame.rsplit. analysis and assessment are shortcuts.

Usage

## S3 method for class 'rsplit'
as.data.frame(x, row.names = NULL, optional = FALSE, data = "analysis", ...)

analysis(x, ...)

assessment(x, ...)

Arguments

x

An rsplit object.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

A logical: should the column names of the data be checked for legality?

data

Either "analysis" or "assessment" to specify which data are returned.

...

Additional arguments to be passed to or from methods. Not currently used.

Examples

library(dplyr)
set.seed(104)
folds <- vfold_cv(mtcars)

model_data_1 <- folds$splits[[1]] %>% analysis()
holdout_data_1 <- folds$splits[[1]] %>% assessment()

rsample

General Resampling Infrastructure

v0.1.0
MIT + file LICENSE
Authors
Julia Silge [aut, cre] (<https://orcid.org/0000-0002-3671-836X>), Fanny Chow [aut], Max Kuhn [aut], Hadley Wickham [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.