cross_plot: Cross-plotting input variable vs. target variable

Description Usage Arguments Value Examples

View source: R/cross_plot.R

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

1
cross_plot(data, input, target, path_out, auto_binning, plot_type = "both")

Arguments

data

data frame source

input

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

target

variable name to predict

path_out

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

auto_binning

indicates the automatic binning of 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
## Example 1:
cross_plot(data=heart_disease, input="chest_pain", target="has_heart_disease")

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

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

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

## End(Not run)

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

funModeling v.1.7 :)
Examples and tutorials at livebook.datascienceheroes.com

Plotting transformed variable 'oldpeak' with 'equal_freq', (too many values). Disable with 'auto_binning=FALSE'
Plotting transformed variable 'age' with 'equal_freq', (too many values). Disable with 'auto_binning=FALSE'
Plotting transformed variable 'oldpeak' with 'equal_freq', (too many values). Disable with 'auto_binning=FALSE'
Plotting transformed variable 'max_heart_rate' with 'equal_freq', (too many values). Disable with 'auto_binning=FALSE'

funModeling documentation built on July 1, 2020, 5:40 p.m.