Learn R Programming

analysisPipelines (version 1.0.2)

getTargetForPyClassification: Extracts selected column from a data frame a binary class Python array

Description

Extracts selected column from a data frame a binary class Python array

Usage

getTargetForPyClassification(dataset, targetVarName, positiveClass)

Arguments

dataset

an R data frame

targetVarName

Name of the target variable for classification. Should be a categorical variable.

positiveClass

Name of the class of the target variable which should be coded as '1'

Details

Helper function, which when provided an R dataframe and a binary categorical column, extracts it from the R data frame, converts it to 1/0 class coding, and converts it to a Python array

Typically this function can be used to extract a target variable for a classifier to be provided to a Python machine learning function

See Also

Other R helper utilities for Python: getFeaturesForPyClassification, setPythonEnvir

Examples

Run this code
# NOT RUN {
getTargetForPyClassification(dataset = iris,
 targetVarName = "Species", positiveClass = "setosa")
# }

Run the code above in your browser using DataLab