Compare the distribution of a target variable vs another variable. This function automatically splits into quantiles for numerical variables. Custom and tidyverse friendly.
distr(data, ..., type = 1, ref = TRUE, note = NA, top = 10,
breaks = 10, na.rm = FALSE, force = "none", trim = 0,
clean = FALSE, abc = FALSE, custom_colours = FALSE, plot = TRUE,
chords = FALSE, save = FALSE, subdir = NA)
Dataframe
Variables. Main (target variable) and secondary (values variable) to group by
Integer. 1 for both plots, 2 for counter plot only, 3 por percentages plot only.
Boolean. Show a reference line if levels = 2? Quite useful when data is unbalanced (not 50/50) because a reference line is drawn
Character. Caption for the plot
Integer. Filter and plot the most n frequent for categorical values
Integer. Number of splits for numerical values
Boolean. Ignore NAs if needed
Character. Force class on the values data. Choose between 'none', 'character', 'numeric', 'date'
Integer. Trim labels until the nth character for categorical values (applies for both, target and values)
Boolean. Use lares::cleanText for categorical values (applies for both, target and values)
Boolean. Do you wish to sort by alphabetical order?
Boolean. Use custom colours function?
Boolean. Return a plot? Otherwise, a table with results
Boolean. Use a chords plot?
Boolean. Save the output plot in our working directory
Character. Into which subdirectory do you wish to save the plot to?
Other Exploratory: corr_cross
,
corr_var
, crosstab
,
df_str
, freqs_df
,
freqs
, gain_lift
,
get_tweets
, missingness
,
plot_cats
, plot_df
,
plot_nums
, tree_var
,
trendsRelated
Other Visualization: corr_plot
,
freqs_df
, freqs
,
mplot_conf
, mplot_cuts_error
,
mplot_cuts
, mplot_density
,
mplot_full
, mplot_gain
,
mplot_importance
,
mplot_lineal
, mplot_metrics
,
mplot_response
, mplot_roc
,
mplot_splits
, noPlot
,
plot_survey
, theme_lares2
,
theme_lares
, tree_var