jofaichow commited on
Commit
e973df1
1 Parent(s): c6e84e1

0.2.6 - added survey results

Browse files
Files changed (1) hide show
  1. app/app.R +25 -20
app/app.R CHANGED
@@ -30,6 +30,31 @@ options(timeout = max(1000, getOption("timeout")))
30
  ls_username <- sort(get_leaderboard()$username)
31
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  # ==============================================================================
35
  # Helper Functions
@@ -1030,20 +1055,6 @@ server <- function(input, output) {
1030
 
1031
  output$dt_survey_summary <- DT::renderDT({
1032
 
1033
- # Get Raw Data
1034
- gs4_deauth()
1035
- d_survey_raw <- read_sheet(ss = "https://docs.google.com/spreadsheets/d/18AM4RkG5KiK3TlDGMx0z7X5Y5-eQE9kgLXM9ng_yXUk",
1036
- sheet = "Form responses 1") %>% data.table()
1037
- colnames(d_survey_raw) <- c("timestamp", "country", "comments")
1038
-
1039
- # Summarise
1040
- d_survey_summary <-
1041
- d_survey_raw %>%
1042
- group_by(country) %>%
1043
- summarise(count = n()) %>%
1044
- arrange(desc(count), country) %>%
1045
- as.data.table()
1046
-
1047
  # Return
1048
  DT::datatable(
1049
 
@@ -1069,12 +1080,6 @@ server <- function(input, output) {
1069
 
1070
  output$dt_survey_raw <- DT::renderDT({
1071
 
1072
- # Get Raw Data
1073
- gs4_deauth()
1074
- d_survey_raw <- read_sheet(ss = "https://docs.google.com/spreadsheets/d/18AM4RkG5KiK3TlDGMx0z7X5Y5-eQE9kgLXM9ng_yXUk",
1075
- sheet = "Form responses 1") %>% data.table()
1076
- colnames(d_survey_raw) <- c("timestamp", "country", "comments")
1077
-
1078
  # Return
1079
  DT::datatable(
1080
 
 
30
  ls_username <- sort(get_leaderboard()$username)
31
 
32
 
33
+ # Prepare survey results data
34
+ if (TRUE) {
35
+
36
+ # Download
37
+ gs4_deauth()
38
+ d_survey_raw <- read_sheet(ss = "https://docs.google.com/spreadsheets/d/18AM4RkG5KiK3TlDGMx0z7X5Y5-eQE9kgLXM9ng_yXUk",
39
+ sheet = "Form responses 1") %>% data.table()
40
+
41
+ # Rename
42
+ colnames(d_survey_raw) <- c("timestamp", "country", "comments")
43
+
44
+ # Summarise
45
+ d_survey_summary <-
46
+ d_survey_raw %>%
47
+ group_by(country) %>%
48
+ summarise(count = n()) %>%
49
+ arrange(desc(count), country) %>%
50
+ as.data.table()
51
+
52
+ }
53
+
54
+
55
+
56
+
57
+
58
 
59
  # ==============================================================================
60
  # Helper Functions
 
1055
 
1056
  output$dt_survey_summary <- DT::renderDT({
1057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  # Return
1059
  DT::datatable(
1060
 
 
1080
 
1081
  output$dt_survey_raw <- DT::renderDT({
1082
 
 
 
 
 
 
 
1083
  # Return
1084
  DT::datatable(
1085