R for
Authoring!!

OOH Session #56…
polling via R: Tinkering

Open Office Hours
(December 17, 2024)

  • Recap session #55       ↔︎️
  • Focal issue(s):
    • polling via : Part VI
  • Shared problem-solving

Recap of Session
#55:

surveydown Part V – Survey Launch:

# remotes::install_github("surveydown-dev/surveydown", force = TRUE)
library(surveydown)

# Database setup

# surveydown stores data on a database that you define at https://supabase.com/
# To connect to a database, update the sd_database() function with details
# from your supabase database. For this demo, we set ignore = TRUE, which will
# ignore the settings and won't attempt to connect to the database. This is
# helpful for local testing if you don't want to record testing data in the
# database table. See the documentation for details:
# https://surveydown.org/store-data

db <- sd_database(
  host   = "aws-0-us-west-1.pooler.supabase.com",     
  dbname = "postgres",
  port   = "6543",
  user   = "postgres.yppmohklyshsiwkpadqa",           
  table  = "Woody",
#  ignore = TRUE                                     
)


# Server setup
server <- function(input, output, session) {

  # Define any conditional skip logic here (skip to page if a condition is true)
  sd_skip_if()

  # Define any conditional display logic here (show a question if a condition is true)
  sd_show_if()

  # Database designation and other settings
  sd_server(
    db = db
  )

}

# shinyApp() initiates your app - don't change it
shiny::shinyApp(ui = sd_ui(), server = server)




# viola
1
The name you choose here will appear as a database table on the Supabase site – data itself is exportable as .csv or .sql.

data <- read.csv("Woody.csv")

descr::freq(data$einstein)

data$einstein 
              Frequency Percent
                      7   53.85
2                     2   15.38
lemon_posicle         4   30.77
Total                13  100.00

Today…

surveydown Part VI – Tinkering:

Session Info (December 17, 2024) Rendering:

R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] fontawesome_0.5.2

loaded via a namespace (and not attached):
 [1] lubridate_1.9.3   emo_0.0.0.9000    digest_0.6.31     crayon_1.5.2     
 [5] assertthat_0.2.1  xtable_1.8-4      lifecycle_1.0.4   jsonlite_1.8.9   
 [9] magrittr_2.0.3    evaluate_1.0.0    descr_1.1.7       stringi_1.7.12   
[13] rlang_1.1.3       cli_3.6.0         rstudioapi_0.15.0 vctrs_0.6.5      
[17] generics_0.1.3    rmarkdown_2.28    tools_4.2.2       stringr_1.5.1    
[21] glue_1.6.2        purrr_1.0.1       xfun_0.42         yaml_2.3.10      
[25] fastmap_1.1.1     compiler_4.2.2    timechange_0.3.0  htmltools_0.5.7  
[29] knitr_1.45