View source: R/explore_basics.R
rt_explore_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_value_totals( dataset, variable, second_variable = NULL, facet_variable = NULL, count_distinct = NULL, sum_by_variable = NULL, multi_value_delimiter = NULL )
dataset |
dataframe containing numberic columns |
variable |
the variable (e.g. factor) to get unique values from |
second_variable |
group by a second variable |
facet_variable |
group by a third variable. However, the 'percent' & 'group percent' are still relative to only 'variable' & 'second_variable' which is NOT equivalent to grouping by a third variable and calculating the percent of all the data. 'percent' will sum to 1 for each facet value. The naming convention for appearing in the table will be '[variable name] - [variable - value]'. This variable is meant to correspond to faceting the data in a graph. |
count_distinct |
count the distinct number of values in this column |
sum_by_variable |
the numeric variable to sum |
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 |
library(ggplot2) rt_explore_value_totals(dataset=iris, variable='Species')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.