Description Usage Arguments See Also Examples
View source: R/background_tab.R
Server-side function for background tab. Makes use of separate_terms_by_gender(), single_plural_chooser(), group_by_primary_sec(), bp(), grouper(), product_format()
1 2 | background(input, output, session, dat, fdat, bg_options, plot_colors,
product_colors)
|
input |
Required for shiny modules' server functions. |
output |
Required for shiny modules' server functions. |
session |
Required for shiny modules' server functions. |
dat |
dataframe, unfiltered dataframe containing demographic data. |
fdat |
dataframe, dat but filtered by demographic variables and product. |
bg_options |
vector, holds 1) (numeric) the column # from fdat containing the question of interest, 2) (function) the appropriate function to clean the column's data, 3) (string) the title for the plot. |
plot_colors |
vector (of strings),holds plot colours (eg. c("#FF0000", "#00FF00", "#0000FF")) (female, male, unknown by default) |
product_colors |
vector, strings; colour for each product for the responses table. (eg. c("#FF0000", "#00FF00", "#0000FF")) |
backgroundUI
, separate_terms_by_gender
, single_plural_chooser
, group_by_primary_sec
, bp
, grouper
, product_format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Requires something along the lines of
## Not run:
bg_options <- reactive({
# column number, cleaner function, and plot title
# to use for a given background question
switch(input$bg_questions,
"Go-to store?" = c(go_to_store_col, grocery_store_cleaner,
"Go-to Energy/Coffee Beverage Stores (Top 10)"),
"Favourite energy-drink brand?" = c(fav_brand_col, energy_drink_cleaner,
"Favourite Energy-drink Brand"),
"Preferred workout?" = c(workout_col, workout_cleaner,
"Preferred Workouts"),
"Pre-Workout brand used?" = c(preworkoutbrand_col, grocery_store_cleaner,
"Pre-Workout Brands Used"))
})
## End(Not run)
# in order to generate bg_options.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.