knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(knitr) library(kableExtra) library(DT) library(highcharter)
library(gndereport) library(ggplot2) library(dplyr) feedback <- read_feedback('~/sci/datasets/gnde_policy_report_feedback/Feedback/') %>% tidy_feedback()
names_tally <- feedback %>% dplyr::count(name) %>% dplyr::arrange(desc(n)) countries_tally <- feedback %>% dplyr::count(country) %>% dplyr::arrange(desc(n)) organizations_tally <- feedback %>% dplyr::count(organization) %>% dplyr::arrange(desc(n)) countries_people_tally <- feedback %>% dplyr::group_by(email) %>% dplyr::summarise(country = dplyr::first(country), name = dplyr::first(name)) %>% dplyr::count(country) %>% dplyr::arrange(desc(n))
r nrow(feedback)
r nrow(names_tally)
r nrow(countries_tally)
r nrow(organizations_tally) - 1
r min(feedback$date)
r max(feedback$date)
r lubridate::now()
WESTnames_tally %>% dplyr::rename(Name = name, n = n) %>% my_datatable(caption = 'Table 1: Comments per person.')
hcmap("custom/world-eckert3-highres", data = countries_people_tally, value = "n", joinBy = c("name", "country"), name = 'People', dataLabels = list(enabled = TRUE, format = '{point.name}'), borderColor = "#9A9A9A", borderWidth = 0.3, tooltip = list(valueDecimals = 0)) %>% hc_mapNavigation(enabled = TRUE) %>% hc_credits(enabled = FALSE) %>% hc_colorAxis(minColor = "#FFFFFF", maxColor = "#55BF35") %>% hc_legend(enabled = FALSE) %>% hc_exporting(enabled = TRUE)
countries_tally %>% dplyr::rename(Country = country, n = n) %>% my_datatable(caption = 'Table 2: Comments by country.')
hcmap("custom/world-eckert3-highres", data = countries_tally, value = "n", joinBy = c("name", "country"), name = 'Comments', dataLabels = list(enabled = TRUE, format = '{point.name}'), borderColor = "#9A9A9A", borderWidth = 0.3, tooltip = list(valueDecimals = 0)) %>% hc_mapNavigation(enabled = TRUE) %>% hc_credits(enabled = FALSE) %>% hc_colorAxis(minColor = "#FFFFFF", maxColor = "#55BF35") %>% hc_legend(enabled = FALSE) %>% hc_exporting(enabled = TRUE)
organizations_tally %>% dplyr::rename(Organization = organization, n = n) %>% my_datatable(caption = 'Table 3: Comments by organization.')
comments_section_tally <- feedback %>% count(organization, choice) %>% arrange(desc(n))
hchart(comments_section_tally, "bar", hcaes(x = organization, y = n, group = choice)) %>% hc_xAxis(title = list(text = ""))
comments_section_tally <- feedback %>% count(chapter, choice)
comments_section_tally %>% dplyr::rename(Section = chapter, Type = choice, n = n) %>% my_datatable(caption = 'Table 4: Comments by section and type.')
hchart(comments_section_tally, "column", hcaes(x = chapter, y = n, group = choice) ) %>% hc_xAxis(title = list(text = "Section")) %>% hc_yAxis(title = "")
table_of_comments <- function(section) { filter(feedback, chapter == section) %>% rename(Date = date, Section = chapter, Name = name, Email = email, Organization = organization, Country = country, `Type of comment` = choice, `Text of the comment` = text) %>% my_datatable(searching = TRUE) }
table_of_comments('2.1')
table_of_comments('2.2.2')
table_of_comments('2.2.3')
table_of_comments('2.2.4')
table_of_comments('2.3.1')
table_of_comments('2.3.2.a')
table_of_comments('2.3.2.b')
table_of_comments('2.4.1')
table_of_comments('2.4.2.a')
table_of_comments('2.4.2.b')
table_of_comments('2.4.2.c')
table_of_comments('2.4.3')
table_of_comments('2.4.4')
table_of_comments('2.4.5')
table_of_comments('2.4.6.c')
table_of_comments('2.4.7')
table_of_comments('3.2.1')
table_of_comments('3.2.2')
table_of_comments('3.3.1')
table_of_comments('3.2.2')
table_of_comments('3.3.1')
table_of_comments('3.3.2')
table_of_comments('3.3.3')
table_of_comments('3.3.4')
table_of_comments('3.4.1')
table_of_comments('3.4.2')
table_of_comments('3.4.3')
table_of_comments('3.4.4')
table_of_comments('4.1')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.