extract_set: Extract train/test dataset

View source: R/split.R

extract_setR Documentation

Extract train/test dataset

Description

Extract train set or test set from split_df class object

Usage

extract_set(x, set = c("train", "test"))

Arguments

x

an object of class "split_df", usually, a result of a call to split_df().

set

character. Specifies whether the extracted data is a train set or a test set. You can use "train" or "test".

Details

Extract the train or test sets based on the parameters you defined when creating split_df with split_by().

Value

an object of class "tbl_df".

Examples

library(dplyr)

# Credit Card Default Data
head(ISLR::Default)

# Generate data for the example
sb <- ISLR::Default %>%
  split_by(default)

train <- sb %>%
  extract_set(set = "train")

test <- sb %>%
  extract_set(set = "test")


alookr documentation built on May 29, 2024, 10:38 a.m.