Learn R Programming

alookr (version 0.5.0)

extract_set: Extract train/test dataset

Description

Extract train set or test set from split_df class object

Usage

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

Value

an object of class "tbl_df".

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().

Examples

Run this code
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")

Run the code above in your browser using DataLab