Learn R Programming

explore (version 1.3.4)

format_target: Format target

Description

Formats a target as a 0/1 variable. If target is numeric, 1 = above average.

Usage

format_target(target)

Value

Formated target

Arguments

target

Variable as vector

Examples

Run this code
iris$is_virginica <- ifelse(iris$Species == "virginica", "yes", "no")
iris$target <- format_target(iris$is_virginica)
table(iris$target)

Run the code above in your browser using DataLab