inst/apps/samplesize_determination_variable/dokumentation/server_gen_reports.R

# test report template-----------------
#https://shiny.rstudio.com/gallery/download-knitr-reports.html

# design-aid template -----------------
output$entwicklungs_report <- downloadHandler(

  filename = function(){
    paste('Empfehlung_Stichprobengroesse_',
          Sys.Date(),
          switch(
            input$report_format_type,
            pdf = ".pdf",
            word = ".docx"
          ),
          sep = "")
    },

  content = function(file) {
    params <- list(ostit = ostit,
                   bootstrap_data = bootstrap_data(),
                   plot_scales_desgin_aid = plot_scales_desgin_aid(),
                   plot_scales_messwerte = plot_scales_messwerte(),
                   report_format_type = input$report_format_type
                   )

    rmarkdown::render(
      file.path("report_templates", "report_sample_size_hint.Rmd"),
      params = params,
      envir = new.env(parent = globalenv()),
      output_file = file,
      output_format =
        switch(
          input$report_format_type ,
          pdf = pdf_document(number_sections = TRUE),
          word = word_document()
        ),
      encoding = "UTF-8"
    )

  }
)
stephanGit/leistungstests documentation built on May 30, 2019, 3:14 p.m.