Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/dqcategorical.R
Takes in a data, and returns summary of categorical variables
1 |
data |
a data.frame or data.table |
While trying to understand a data, it is important to know the distribution of
categorical variables. dqcategorical
produces an output which answers a
couple of questions regarding such variabes - how many distinct categories does
the variable have, what are the categories, what is the frequency
of each of them and the percentage frequency.
But first, it is critical to identify categorical variables in the data. They may be
integer, numeric or character. All such variables should be converted to factor; one
may use factorise
function in this package to do this task easily.
The function identifies all the factor variables and produces an output for each of them and returns a consolidated summary. It works for both 'data.frame' and 'data.table' but the output summary is a 'data.frame' only.
a data.frame which contains the variable, category index, category, category frequency and percentage frequency of all factor variables
Akash Jain
dqcontinuous
, dqdate
, contents
1 2 3 4 5 6 7 8 9 10 | # A 'data.frame'
df <- data.frame(phone = c('IP', 'SN', 'HO', 'IP', 'SN', 'IP', 'HO', 'SN', 'IP', 'SN'),
colour = c('black', 'blue', 'green', 'blue', 'black', 'silver', 'black',
'white', 'black', 'green'))
# Factorise categorical variables
df <- factorise(data = df, colNames = c('phone', 'colour'))
# Generate a data quality report of continuous variables
summaryCategorical <- dqcategorical(data = df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.