View source: R/explore_basics.R
rt_explore_plot_value_totals | R Documentation |
If 'multi_value_delimiter' is not NULL, then it counts all the values found after it splits/separates the variable by the delimiter. If 'sum_by_variable' is NULL, it counts the values and the denominator for the 'percent' column returned is the total number of records. If 'sum_by_variable' is not NULL, then when multiple values are found, each value is weighted by the value found in 'sum_by_variable', and the denominator for the 'percent' column returned is the 'sum' of 'sum_by_variable' (before the values are split).
rt_explore_plot_value_totals( dataset, variable, comparison_variable = NULL, facet_variable = NULL, sum_by_variable = NULL, count_distinct_variable = NULL, order_by_count = TRUE, show_variable_totals = TRUE, show_comparison_totals = TRUE, show_dual_axes = FALSE, view_type = "Bar", multi_value_delimiter = NULL, reverse_stack = TRUE, simple_mode = FALSE, base_size = 11 )
dataset |
dataframe containing numberic columns |
variable |
the variable (e.g. factor) to get unique values from |
comparison_variable |
the additional variable to group by; must be a string/factor column |
facet_variable |
additional variable to facet by |
sum_by_variable |
the numeric variable to sum |
count_distinct_variable |
when aggregating, rather than counting the total number of records, count distinct occurances of this variabled (cannot be used with 'sum_by_variable') |
order_by_count |
if TRUE (the default) it will plot the bars from most to least frequent, otherwise it will order by the original factor levels if applicable |
show_variable_totals |
if TRUE (the default) the graph will display the totals for the variable |
show_comparison_totals |
if TRUE (the default) the graph will display the totals for the comparison_variable |
show_dual_axes |
show a secondary axis for the Count or Sum |
view_type |
this setting describes the type/view of the graph Options are: "Bar" - Default option, for either single variable or with comparison_variable, bar-chart "Confidence Interval" - for either single variable or with comparison variable; when comparison_variable is not NULL, the denominator/count used is the same as faceting "Confidence Interval - within Variable" - valid when comparison_variable is not null, this provides confidence intervals similar to the "Stack" view "Stack" - valid when comparison_variable is not null, stack comparison variable within variable "Stack Percent" - valid when comparison_variable is not null, stack comparison variable within variable (i.e. for each variable value, the comparison_variable percentages are shown) |
multi_value_delimiter |
if the variable contains multiple values (e.g. "A", "A, B", ...) then setting this variable to the delimiter will cause the function to count seperate values |
reverse_stack |
reverse stack from the default stacking order (defaulted to 'TRUE') |
simple_mode |
changes to single color for single bar charts and removes percentages |
base_size |
uses ggplot's base_size parameter for controling the size of the text |
Currently only works when using only 'variable' (not 'comparison_variable')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.