categorical.predictive.power: categorical.predictive.power

View source: R/variables.R

categorical.predictive.powerR Documentation

categorical.predictive.power

Description

Function that graphs the distribution of individuals and shows their category according to a categorical variable.

Usage

categorical.predictive.power(
  data,
  predict.variable,
  variable.to.compare,
  ylab = "",
  xlab = "",
  main = paste("Variable Distribution", variable.to.compare, "according to",
    predict.variable),
  col = NA
)

Arguments

data

A data frame.

predict.variable

Character type. The name of the variable to predict. This name must be part of the columns of the data frame.

variable.to.compare

Character type. The name of the categorical variable to compare. This name must be part of the columns of the data frame.

ylab

A character string that describes the y-axis on the graph.

xlab

A character string that describes the x-axis on the graph.

main

Character type. The main title of the chart.

col

A vector that specifies the colors of the categories of the variable to predict.

Value

A ggplot object.

Note

With this function we can analyze the predictive power of a categorical variable.

See Also

ggplot

Examples


cars <- datasets::mtcars
cars$cyl <- as.factor(cars$cyl)
cars$vs <- as.factor(cars$vs)
categorical.predictive.power(cars,"vs","cyl")


PROMiDAT/trainR documentation built on Nov. 13, 2023, 3:20 a.m.