finddx / finddxtemplate

https://finddx.github.io/finddxtemplate/
0 stars 0 forks source link

Create 3 different report styles based on intended use #9

Open ArthurData opened 2 years ago

ArthurData commented 2 years ago

According to the intended use is there a possibility to have 3 different report styles based on intended use?

Some features to add:

1/ When a formal report is needed, tables usually are short and descriptive , created with {gtsummary} package functions and all table packages. Is it possible to import them in the package, or we should install the packages in the rmd code chunks?

2/ For formal report, possibility to add a list of authors with affiliations?

statnmap commented 2 years ago

If its a technical report

---
title: "My report"
author: "Arthur Bréant"
date: "1/13/2022"
logo: "`r system.file('logo', 'logo.svg', package = 'finddxtemplate')`"
output: finddxtemplate::html_document_find
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  echo = FALSE
)
statnmap commented 2 years ago

For word. You can add your template inside the package "inst/"

Tell the users how to use it

file.copy(system.file("my_finddx_template.docx", package = "finddxtemplate"), path/where_i_want/my_finddx_template.docx)

Maybe this works

title: "My report"
author: "Arthur Bréant"
date: "1/13/2022"
output: 
   word_document:
     reference_docx: `r system.file("my_finddx_template.docx", package = "finddxtemplate"))`
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  echo = FALSE
)
statnmap commented 2 years ago

For PDF:

statnmap commented 2 years ago

You can add your templates that are ready inside "inst/rmarkdown/templates"

like here: https://github.com/ThinkR-open/fusen/tree/main/inst/rmarkdown/templates/additional

statnmap commented 2 years ago

Add in your templates

library(mypalettepackage)
statnmap commented 2 years ago

use different color palettes

ggplot2::theme_set(my_theme())

opts <- options() # save old options

options(ggplot2.continuous.colour="viridis") options(ggplot2.continuous.fill = "viridis")


For instance, if you have

scale_color_discrete_finddx <- function(palette = "test", extend = FALSE, ...){

pal <- retrieve_palette(palette, "base") ggplot2::discrete_scale("colour", "test", manual_pal_flex(pal, extend), na.value = "grey50", ...)

}

You can use

options(ggplot2.continuous.colour="finddx")