Description Usage Arguments Details Value See Also Examples
plots a dataframe as an alluvial plot. All numerical variables are scaled, centered and YeoJohnson transformed before binning.
1 2 3 4 5 6 7 | f_plot_alluvial(data, variables = names(data), col_id = NULL,
max_variables = 20, bins = 5, bin_labels = c("LL", "ML", "M", "MH",
"HH"), NA_label = "NA", order_levels = NULL,
fill_by = "first_variable",
col_vector_flow = f_plot_col_vector74(faint = F, greys = F),
col_vector_value = RColorBrewer::brewer.pal(9, "Greys")[c(3, 6, 4, 7,
5)])
|
data |
a dataframe |
variables |
vector denoting names and order of the plotted variables, Default: names(data) |
col_id |
character vector denoting id column |
max_variables |
maximum number of variables, Default: 20 |
bins |
number of bins for numerical variables, Default: 5 |
bin_labels |
labels for the bins from low to high, Default: c("LL", "ML", "M", "MH", "HH") |
NA_label |
character vector define label for missing data |
order_levels |
character vector denoting levels to be reorderer from low to high |
fill_by |
one_of(c('first_variable', 'last_variable', 'all_flows', 'values')), Default: 'first_variable' |
col_vector_flow |
HEX colors for flows, Default: f_plot_col_vector74(faint = F, greys = F) |
col_vector_value |
Hex colors for y levels/values, Default: RColorBrewer::brewer.pal(9, "Greys")[c(3, 6, 4, 7, 5)] |
DETAILS
OUTPUT_DESCRIPTION
brewer.pal
fct_relevel
geom_flow
,geom_stratum
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## Not run:
if(interactive()){
data_ls = mtcars %>%
f_clean_data()
data = data_ls$data
max_variables = 5
variables = c( data_ls$categoricals[1:3], data_ls$numericals[1:3] )
f_plot_alluvial( data = data
, variables = variables
, max_variables = max_variables
, fill_by = 'first_variable' )
f_plot_alluvial( data = data
, variables = variables
, max_variables = max_variables
, fill_by = 'last_variable' )
f_plot_alluvial( data = data
, variables = variables
, max_variables = max_variables
, fill_by = 'all_flows' )
f_plot_alluvial( data = data
, variables = variables
, max_variables = max_variables
, fill_by = 'first_variable' )
# manually order variable values
f_plot_alluvial( data = data
, variables = variables
, max_variables = max_variables
, fill_by = 'values'
, order_levels = c('1', '0') )
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.