as.data.frame.rsplit: Convert an 'rsplit' object to a data frame

Description Usage Arguments Examples

View source: R/rsplit.R

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

1
2
3
4
5
6
7
## 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

1
2
3
4
5
6
library(dplyr)
set.seed(104)
folds <- vfold_cv(mtcars)

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

Example output

Loading required package: tidyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

rsample documentation built on July 13, 2019, 1:05 a.m.