View source: R/fn_exp_categorical.R
ExpCTable | R Documentation |
this function will automatically select categorical variables and generate frequency or cross tables based on the user inputs. Output includes counts, percentages, row total and column total.
ExpCTable(
data,
Target = NULL,
margin = 1,
clim = 10,
nlim = 10,
round = 2,
bin = 3,
per = FALSE,
weight = NULL
)
data |
dataframe or matrix |
Target |
target variable (dependent variable) if any. Default NULL |
margin |
margin of index, 1 for row based proportions and 2 for column based proportions |
clim |
maximum categories to be considered for frequency/custom table. Variables will be dropped if unique levels are higher than 'clim' for class factor/character variable. Default value is 10. |
nlim |
numeric variable unique limits. Default 'nlim' values is 3, table excludes the numeric variables which is having greater than 'nlim' unique values |
round |
round off |
bin |
number of cuts for continuous target variable |
per |
percentage values. Default table will give counts |
weight |
a vector of weights, it must be equal to the length of data |
this function provides both frequency and custom tables for all categorical features. And ouput will be generated in data frame
Frequency tables, Cross tables
Columns description for frequency tables:
Variable
is Variable name
Valid
is Variable values
Frequency
is Frequency
Percent
is Relative frequency
CumPercent
is Cumulative sum of relative frequency
Columns description for custom tables:
Variable
is Variable name
Category
is Variable values
Count
is Number of counts
Per
is Percentages
Total
is Total count
# Frequency table
ExpCTable(mtcars, Target = NULL, margin = 1, clim = 10, nlim = 3, bin = NULL, per = FALSE)
# Crosstbale for Mtcars data
ExpCTable(mtcars, Target = "gear", margin = 1, clim = 10, nlim = 3, bin = NULL, per = FALSE)
# Weighted frequecncy for Mtcars data
ExpCTable(mtcars, margin = 1, clim = 10, nlim = 3, bin = NULL, per = FALSE, weight = "wt")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.