Learn R Programming

funModeling (version 1.6.6)

cross_plot: Cross-plotting input variable vs. target variable

Description

The cross_plot shows how the input variable is correlated with the target variable, getting the likelihood rates for each input's bin/bucket .

Usage

cross_plot(data, str_input, str_target, path_out, auto_binning,
  plot_type = "both")

Arguments

data

data frame source

str_input

string input variable (if empty, it runs for all numeric variable), it can take a single character value or a character vector.

str_target

string of the variable to predict

path_out

path directory, if it has a value the plot is saved

auto_binning

indicates the automatic binning of str_input variable based on equal frequency (function 'equal_freq'), default value=TRUE

plot_type

indicates if the output is the 'percentual' plot, the 'quantity' or 'both' (default).

Value

cross plot

Examples

Run this code
# NOT RUN {
## Example 1:
cross_plot(data=heart_disease, str_input="chest_pain", str_target="has_heart_disease")

## Example 2: Disabling auto_binning:
cross_plot(data=heart_disease, str_input="oldpeak",
		str_target="has_heart_disease", auto_binning=FALSE)

## Example 3: Saving the plot into a folder:
cross_plot(data=heart_disease, str_input="oldpeak",
		str_target="has_heart_disease", path_out = "my_folder")

## Example 4: Running with multiple input variables at the same time:
cross_plot(data=heart_disease, str_input=c("age", "oldpeak", "max_heart_rate"),
		str_target="has_heart_disease")
# }

Run the code above in your browser using DataLab