Learn R Programming

scorecard (version 0.1.8)

split_df: Split a dataset

Description

Split a dataset

Usage

split_df(dt, y = NULL, ratio = 0.7, seed = 186)

Arguments

dt

A data frame.

y

Name of y variable, default is NULL. The input data will split based on the predictor y, if it is provide.

ratio

A numeric value, default is 0.7. It indicates the ratio of total rows contained in one split, must less than 1.

seed

A random seed, default is 186.

Examples

Run this code
# NOT RUN {
# Load German credit data
data(germancredit)

dt_list = split_df(germancredit, y="creditability")
train = dt_list$train
test = dt_list$test

# }

Run the code above in your browser using DataLab