knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
  )

library(knitr)

Prepare Inputs

Load input

For details please see Input formats & loading files

library(hypegrammaR)
library(dplyr)

assessment_data<-load_data("../data/testdata.csv")

'

samplingframe<-load_samplingframe("../data/test_samplingframe.csv")

'

weights<-map_to_weighting(sampling.frame = samplingframe,
                          data.stratum.column = "stratification",
                          sampling.frame.population.column = "population",
                          sampling.frame.stratum.column = "strata.names",
                          data = assessment_data)

'

questionnaire<-load_questionnaire(data = assessment_data,
                                  questions = "../data/test_questionnaire_questions.csv",
                                  choices = "../data/test_questionnaire_choices.csv",
                                  choices.label.column.to.use = "label::English"
)

'

analysisplan<-load_analysisplan(df = hypegrammaR::test_analysisplan)
analysisplan<-load_analysisplan(df = hypegrammaR::test_analysisplan)

Run the analysis plan & save outputs as an html file

list_of_results <- assessment_data %>%  from_analysisplan_map_to_output(analysisplan = analysisplan,
                                                                        weighting = weights,
                                                                        questionnaire = questionnaire) 

Output as html

list_of_results %>% map_to_template(questionnaire = questionnaire,
                                    dir = "./",
                                    type = "summary",
                                    filename = "my_example_report.html")


mabafaba/hypegrammaR documentation built on Oct. 2, 2019, 11:33 a.m.