Learn R Programming

scorecard (version 0.1.5)

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, defaults NULL. The dataset dt will split based on the predictor y, if it is specified.

ratio

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

seed

A random seed, defaults 186. The specify seed is used for random sorting data.

Examples

Run this code
# NOT RUN {
library(scorecard)
data(germancredit)

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

# }

Run the code above in your browser using DataLab