Description Usage Arguments Details Value Examples
A family of functions to analyze a data.frame and output the descriptive analysis results and/or visualization.
1 2 3 4 5 6 | describe_df(data, qual_vars, quan_vars, nrow = 1, ncol = 1, ...)
cal_df_distrib(data, qual_vars, quan_vars, ...)
vis_df_distrib(data, qual_vars, quan_vars, nrow = NULL, ncol = NULL,
...)
|
data |
a data.frame |
qual_vars |
variable(s) indicating the qualitative variable(s). It accepts five forms:
|
quan_vars |
variable(s) indicating the quantitative variable(s). It accepts five forms:
|
nrow |
NULL or positive integer. Only applicable for |
ncol |
NULL or positive integer. Only applicable for |
... |
other arguments to pass to
|
describe_df
is a wrapper of cal_df_distrib
and
vis_df_distrib
.
cal_df_distrib
, built on top of describe_num_cols
and
describe_chr_cols
, returns two lists: one for quantitative variables
and the other for qualitative ones.
vis_df_distrib
, built on top of vis_num_cols
and
vis_chr_cols
, returns two sets of plots: one for quantitative variables
and the other for qualitative ones, each of which contains one or multiple
ggplots objects.
describe_df
(): a list of results by cal_df_distrib
and
vis_df_distrib
cal_df_distrib
(): two lists of tibbles
a tibble with 4 columns: <varname>, 'value', 'freq', 'prop'
;
or a character "no match columns"
a tibble with 11 columns: <varname>, 'count', 'n_na', 'p_na'
,
'mean', 'sd', 'min', 'lower', 'median', 'higher', 'max'
; or a character
"no match columns"
vis_df_distrib
(): two sets of plots
nrow
and ncol
are 1 respectively, then the distribution
plots (histogram or bar plots) will be shown one by one.
either nrow
or ncol
is more than 1, then the plots will
be organized in facetted plots (with facet_wrap()
).
If both nrow
and ncol
are NULL, then the plots will be
organized into one plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
describe_df(mtcars, vars(am, cyl, mpg, wt), NULL)
# you can also detect the distribution of the data in clipboard
describe_df(parse_clipb())
## End(Not run)
## Not run:
cal_df_distrib(iris) ## or
library(dplyr)
cal_df_distrib(iris, quan_vars=vars(Sepal.Length, Petal.Length))
## End(Not run)
## Not run:
library(dplyr)
vis_df_distrib(mtcars, qual=vars(am, cyl), quan=vars(mpg, wt))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.