knitr::opts_chunk$set(echo = FALSE) # produce dataset for unique individuals unique_data <- params$data # where is this report for? if(isTruthy(params$inputs$location_3)){ location <- params$inputs$location_3 } else if(isTruthy(params$inputs$location_2)){ location <- params$inputs$location_2 } else if(isTruthy(params$inputs$location_1)){ location <- params$inputs$location_1 } else { # nothing selected location <- "the whole trust" }
This report summarises data from r format(params$dates[1], "%b %d %Y")
to r format(params$dates[2], "%b %d %Y")
, within r location
.
if("category_table" %in% params$options){ cat("## Sub Categories \n") cat("###", params$comment_1, " \n") calculate_table( table_data = params$single_label_data, count_column = "category", comment_type = "comment_1" ) %>% pander::pandoc.table() cat(" \n") if(isTruthy(params$comment_2)){ cat("###", params$comment_2, " \n") calculate_table( table_data = params$single_label_data, count_column = "category", comment_type = "comment_2" ) %>% pander::pandoc.table() cat(" \n") } }
if("verbatim_comments" %in% params$options){ cat("## Verbatim comments \n") cat("Note that in the interests of brevity comments where the assigned category is 'Labelling not possible' are omitted \n") cat(" \n") cat("###", params$comment_1, ": Comments \n") verbatim_comments(params$single_label_data, 'comment_1') cat("###", params$comment_2, ": Comments \n") verbatim_comments(params$single_label_data, "comment_2") }
if("sample_demographics" %in% params$options){ cat("## Demographic features of sample \n") cat("### ", stringr::str_to_title(params$demography_1), " \n") print(demographic_distribution(unique_data, params$demography_1, return_ggplot = TRUE)) cat(" \n") cat(" \n") cat("### ", stringr::str_to_title(params$demography_2), " \n") print(demographic_distribution(unique_data, params$demography_2, return_ggplot = TRUE)) cat(" \n") cat(" \n") cat("### ", stringr::str_to_title(params$demography_3), " \n") print(demographic_distribution(unique_data, params$demography_3, return_ggplot = TRUE)) cat(" \n") }
if("fft_graph" %in% params$options){ cat("## FFT \n") graph_data <- split_data_spc( unique_data, variable = "fft", chunks = "monthly" ) # confirm we have at least 10 groups to plot no_group <- graph_data %>% dplyr::pull(1) %>% unique() %>% length() if (no_group < 10){ print(p('There are not enough stable SPC points to plot. Please expand your selection')) } else{ print(plot_fft_spc(graph_data)) } cat(" \n") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.