Untitled

R: Import Data

library(tidyverse)
# install.packages("here)
data <- readr::read_rds(here::here("data", "processed", "survey_with_labels.rds"))

R: Transpose Data for OJS

data_ojs <- data %>% transpose()

Exploration

R: Expose Data to JS

ojs_define(data = data_ojs)
ojs_define(varnames = names(data))
ojs_define(qlabels = attributes(data)$variable.labels)

R + OJS: Interaction

OJS: Dropdown

viewof varname_selected = Inputs.select(varnames,
  {label: "Filter nach:"}
)
viewof filter_val = Inputs.select(varnames,
  {label: "Filter nach:"}
)

OJS: Table

viewof tableData = Inputs.table(
  data,
    {
      sort: varname_selected, required: false
    }
)

MAIN: Dynamic ggplot