Learn R Programming

creditmodel (version 1.3.0)

cross_table: cross_table

Description

cross_table is for cross table analysis.

Usage

cross_table(
  dat,
  cross_x,
  cross_y = NULL,
  target = NULL,
  value = NULL,
  cross_type = "total_sum"
)

Arguments

dat

A data.frame with independent variables.

cross_x

Names of variables to cross.

cross_y

Names of variables to cross.

target

The name of target variable.

value

The name of the variable to sum. When this parameter is NULL, the default statistics is to sum frequency.

cross_type

Output form of the result of crosstable. Provide these forms: "total_sum","total_pct","total_mean","total_median","total_max","total_min","bad_sum","bad_pct".

Value

A cross table.

Examples

Run this code
# NOT RUN {
cross_table(dat = UCICreditCard, cross_x = "SEX",cross_y = "AGE",
 target = "default.payment.next.month", cross_type = "bad_pct",value = "LIMIT_BAL")
cross_table(dat = UCICreditCard, cross_x = "SEX",cross_y = "AGE",
 target = "default.payment.next.month", cross_type = "total_pct",value = "LIMIT_BAL")
cross_table(dat = UCICreditCard, cross_x = "SEX",cross_y = "AGE",
 target = "default.payment.next.month", cross_type = "total_mean",value = "LIMIT_BAL")
cross_table(dat = UCICreditCard, cross_x = "SEX",cross_y = "AGE",
 target = "default.payment.next.month", cross_type = "total_median",value = "LIMIT_BAL")
cross_table(dat = UCICreditCard, cross_x = c("SEX", "MARRIAGE"), cross_y = "AGE",
target = "default.payment.next.month", cross_type = "bad_pct",value = "LIMIT_BAL")
# }

Run the code above in your browser using DataLab