Skip to content

Instantly share code, notes, and snippets.

@erikerhardt
Created December 15, 2023 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikerhardt/a041452333d4a803423f0600f6b3d9fb to your computer and use it in GitHub Desktop.
Save erikerhardt/a041452333d4a803423f0600f6b3d9fb to your computer and use it in GitHub Desktop.
erik_qmd_template_presentation_pptx.qmd
---
title: Title
subtitle: Subtitle
author: Erik Erhardt
date: last-modified # today, now, last-modified
#date-format: long # full, long, medium, short, iso, https://quarto.org/docs/reference/dates.html
date-format: "MM/DD/YYYY \\ hh:mm:ss A ZZ"
google-scholar: true
author-title: Author
affiliation-title: Affiliation
abstract-title: Abstract
description-title: Description
published-title: Published
doi-title: DOI
appendix-style: default # plain, default, none # https://quarto.org/docs/authoring/appendices.html
lang: en
format:
pptx: # pptx format https://quarto.org/docs/presentations/powerpoint.html
# PowerPoint Options https://quarto.org/docs/reference/formats/presentations/pptx.html
theme: litera # default, cerulean, cosmo, cyborg, darkly, flatly, journal, litera, lumen, lux, materia, minty, morph, pulse, quartz, sandstone, simplex, sketchy, slate, solar, spacelab, superhero, united, vapor, yeti, zephyr
highlight-style: atom-one # a11y, arrow, atom-one, ayu, breeze, github, gruvbox; pygments, tango, espresso, zenburn, kate, monochrome, breezedark, haddock; dracula, mokokai, nord, oblivion, printing, radical, solarized, vim-dark
#page-layout: full # article, full # https://quarto.org/docs/output-formats/page-layout.html
toc: true
toc-depth: 4
#toc-location: body # left, body, right
toc-title: Contents
number-sections: true # true, false
number-offset: 0 # Offset for section headings in output
#number-depth: 5
shift-heading-level-by: -1 # Shift heading levels by a positive or negative integer. if -1, level 2 headings become level 1 headings, etc.
incremental: false # if true, then lists: ::: {.incremental} or ::: {.nonincremental}
slide-level: 2 # Specifies that headings with the specified level create slides. Headings above this level in the hierarchy are used to divide the slide show into sections; headings below this level create subheads within a slide.
#code-fold: show # true (initially hidden), false, show (initially shown)
#code-tools: # menu top-right to show/hide all code
# toggle: true
# caption: "Code" # none
# source: false
#code-summary: "Code" #, click to show"
#code-overflow: scroll # scroll, wrap
#code-block-bg: true
#code-block-border-left: "#30B0E0"
#code-copy: hover # true, false, hover a copy buttom in top-right of code block
tbl-colwidths: auto # Apply explicit table column widths for markdown grid tables and pipe tables that are more than columns characters wide (72 by default).
df-print: paged # default, kable, tibble, paged # https://quarto.org/docs/computations/r.html
self-contained: false # !!! this can cause a render error: "ERROR: The process cannot access the file because it is being used by another process. (os error 32)"
self-contained-math: true
#html-math-method: katex # https://quarto.org/docs/output-formats/html-basics.html
title-block-style: default # plain, none
title-block-banner: false # background color: true, false, "#95b7fc"
title-block-banner-color: "#232323" # text color: "#232323"
fig-width: 6
fig-height: 4
fig-align: center # default, left, right, or center
fig-cap-location: bottom # bottom, top, margin
tbl-cap-location: top # top, bottom, margin
fig-format: png # Default format for figures generated by Matplotlib or R graphics (retina, png, jpeg, svg, or pdf)
fig-dpi: 300 # Default DPI for figures generated by Matplotlib or R graphics.
callout-appearance: default # default, simple, minimal
reference-location: section # document, section, block, margin
citation-location: document # document, margin
crossref: # https://quarto.org/docs/authoring/cross-references.html
fig-title: Figure # (default is "Figure")
tbl-title: Table # (default is "Table")
title-delim: ":" # (default is ":")
fig-prefix: Figure # (default is "Figure")
tbl-prefix: Table # (default is "Table")
ref-hyperlink: true # (default is true), false
labels: arabic # (default is arabic)
subref-labels: alpha a # (default is alpha a)
chapters: true
lof-title: List of Figures
lot-title: List of Tables
execute: # https://quarto.org/docs/computations/execution-options.html, https://quarto.org/docs/computations/r.html
cache: false # false, true
#freeze: auto # auto = re-render only when source changes, true, false
eval: true # true, false Evaluate the code chunk (if false, just echos the code into the output).
echo: true # true, false Include the source code in output
output: true # true, false Include the results of executing the code in the output (true, false, or asis to indicate that the output is raw markdown and should not have any of Quarto’s standard enclosing markdown).
message: true # true, false Include messages in the output.
warning: true # true, false Include warnings in the output.
error: true # true, false Include errors in the output (note that this implies that errors executing code will not halt processing of the document).
include: true # true, false Catch all for preventing any output (code or results) from being included (e.g. include: false suppresses all output from the code block).
---
<!---
# Erik's compile commands in R:
setwd("D:/Dropbox/StatAcumen/consult/Rpackages/erikmisc/data-raw/qmd_template")
fn_qmd <- "erik_qmd_template_presentation_pptx.qmd"
quarto::quarto_render(input = fn_qmd)
-->
```{r chunk-01, echo=FALSE}
options(width = 80)
#options(warn = -1)
options(str = strOptions(list.len = 1e3))
options(knitr.kable.NA = '') # Display NAs as blanks
my_seed <- 34567
set.seed(my_seed)
```
# Executive summary {#sec-Executive_summary}
# Introduction {#sec-Introduction}
## Background/rationale
* Explain the scientific background and rationale for the investigation being reported
## Objectives
* State specific objectives, including any prespecified hypotheses
## Literature Review:
* Review of relevant prior research and theories.
* Identification of gaps in existing knowledge.
# Methods {#sec-Methods}
## Study design
* Present key elements of study design early in the paper
## Setting
* Describe the setting, locations, and relevant dates, including periods of recruitment, exposure, follow-up, and data collection
## Participants
* Cohort study --- Give the eligibility criteria, and the sources and methods of selection of participants. Describe methods of follow-up
* Case-control study --- Give the eligibility criteria, and the sources and methods of case ascertainment and control selection. Give the rationale for the choice of cases and controls
* Cross-sectional study --- Give the eligibility criteria, and the sources and methods of selection of participants
* Cohort study --- For matched studies, give matching criteria and number of exposed and unexposed
* Case-control study --- For matched studies, give matching criteria and the number of controls per case
## Variables
* Clearly define all outcomes, exposures, predictors, potential confounders, and effect modifiers. Give diagnostic criteria, if applicable
## Data sources/measurement
* Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
* For each variable of interest, give sources of data and details of methods of assessment (measurement). Describe comparability of assessment methods if there is more than one group
## Bias
* Describe any efforts to address potential sources of bias
## Study size
* Explain how the study size was arrived at
## Quantitative variables
* Explain how quantitative variables were handled in the analyses. If applicable, describe which groupings were chosen and why
## Statistical methods
* Describe all statistical methods, including those used to control for confounding
* Describe any methods used to examine subgroups and interactions
* Explain how missing data were addressed
* Cohort study --- If applicable, explain how loss to follow-up was addressed
* Case-control study --- If applicable, explain how matching of cases and controls was addressed
* Cross-sectional study --- If applicable, describe analytical methods taking account of sampling strategy
* Describe any sensitivity analyses
# Results {#sec-Results}
## Participants
* *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
* Report numbers of individuals at each stage of study --- eg numbers potentially eligible, examined for eligibility, confirmed eligible, included in the study, completing follow-up, and analysed
* Give reasons for non-participation at each stage
* Consider use of a flow diagram
## Descriptive data
* *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
* (a) Give characteristics of study participants (eg demographic, clinical, social) and information on exposures and potential confounders
* (b) Indicate number of participants with missing data for each variable of interest
* (c) Cohort study --- Summarise follow-up time (eg, average and total amount)
## Outcome data
* *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
* Cohort study --- Report numbers of outcome events or summary measures over time
* Case-control study --- Report numbers in each exposure category, or summary measures of exposure
* Cross-sectional study --- Report numbers of outcome events or summary measures
## Main results
* Give unadjusted estimates and, if applicable, confounder-adjusted estimates and their precision (eg, 95% confidence interval). Make clear which confounders were adjusted for and why they were included
* Report category boundaries when continuous variables were categorized
* If relevant, consider translating estimates of relative risk into absolute risk for a meaningful time period
## Other analyses
* Report other analyses done --- eg analyses of subgroups and interactions, and sensitivity analyses
# Discussion {#sec-Discussion}
## Key results
* Summarise key results with reference to study objectives
## Limitations
* Discuss limitations of the study, taking into account sources of potential bias or imprecision. Discuss both direction and magnitude of any potential bias
## Interpretation
* Give a cautious overall interpretation of results considering objectives, limitations, multiplicity of analyses, results from similar studies, and other relevant evidence
## Generalisability
* Discuss the generalisability (external validity) of the study results
# Conclusion {#sec-Conclusion}
## Summary of the main findings.
## Implications of the study.
## Suggestions for future research.
# References {#sec-References}
## List of all sources cited in the report, following a specific citation style (e.g., APA, MLA, Chicago).
# Appendices {#sec-Appendices}
## Supplementary materials such as raw data, additional tables or figures, questionnaires, etc.
# Other information {#sec-Other_information}
## Funding
* Give the source of funding and the role of the funders for the present study and, if applicable, for the original study on which the present article is based
Note: An Explanation and Elaboration article discusses each checklist item and gives methodological background and published examples of transparent reporting. The STROBE checklist is best used in conjunction with this article (freely available on the Web sites of PLoS Medicine at http://www.plosmedicine.org/, Annals of Internal Medicine at http://www.annals.org/, and Epidemiology at http://www.epidem.com/). Information on the STROBE Initiative is available at www.strobe-statement.org.
--------------------------------------------------------------------------------
# Report sections
STROBE <https://www.strobe-statement.org/index.php?id=available-checklists>
STROBE Statement --- checklist of items that should be included in reports of observational studies
Added some additional items.
1. Title Page:
1. Title of the Report
1. Author(s) Name(s)
1. Affiliation(s)
1. Date
1. Title and abstract/Executive summary
1. Indicate the study's design with a commonly used term in the title or the abstract
1. Provide in the abstract an informative and balanced summary of what was done and what was found
1. Abstract:
1. A brief summary of the report, typically around 150-250 words, highlighting the purpose, methods, results, and conclusions.
1. Table of Contents (optional):
1. List of sections and subsections with page numbers for easy navigation.
1. List of Figures and Tables (optional):
1. If your report contains numerous figures and tables, provide a list with their titles and page numbers.
1. List of Abbreviations (optional):
1. Define any acronyms or abbreviations used in the report.
1. Introduction
1. Background/rationale
1. Explain the scientific background and rationale for the investigation being reported
1. Objectives
1. State specific objectives, including any prespecified hypotheses
1. Literature Review:
1. Review of relevant prior research and theories.
1. Identification of gaps in existing knowledge.
1. Methods
1. Study design
1. Present key elements of study design early in the paper
1. Setting
1. Describe the setting, locations, and relevant dates, including periods of recruitment, exposure, follow-up, and data collection
1. Participants
1. Cohort study --- Give the eligibility criteria, and the sources and methods of selection of participants. Describe methods of follow-up
1. Case-control study --- Give the eligibility criteria, and the sources and methods of case ascertainment and control selection. Give the rationale for the choice of cases and controls
1. Cross-sectional study --- Give the eligibility criteria, and the sources and methods of selection of participants
1. Cohort study --- For matched studies, give matching criteria and number of exposed and unexposed
1. Case-control study --- For matched studies, give matching criteria and the number of controls per case
1. Variables
1. Clearly define all outcomes, exposures, predictors, potential confounders, and effect modifiers. Give diagnostic criteria, if applicable
1. Data sources/ measurement
1. *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
1. For each variable of interest, give sources of data and details of methods of assessment (measurement). Describe comparability of assessment methods if there is more than one group
1. Bias
1. Describe any efforts to address potential sources of bias
1. Study size
1. Explain how the study size was arrived at
1. Quantitative variables
1. Explain how quantitative variables were handled in the analyses. If applicable, describe which groupings were chosen and why
1. Statistical methods
1. Describe all statistical methods, including those used to control for confounding
1. Describe any methods used to examine subgroups and interactions
1. Explain how missing data were addressed
1. Cohort study --- If applicable, explain how loss to follow-up was addressed
1. Case-control study --- If applicable, explain how matching of cases and controls was addressed
1. Cross-sectional study --- If applicable, describe analytical methods taking account of sampling strategy
1. Describe any sensitivity analyses
1. Results
1. Participants
1. *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
1. Report numbers of individuals at each stage of study --- eg numbers potentially eligible, examined for eligibility, confirmed eligible, included in the study, completing follow-up, and analysed
1. Give reasons for non-participation at each stage
1. Consider use of a flow diagram
1. Descriptive data
1. *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
1. (a) Give characteristics of study participants (eg demographic, clinical, social) and information on exposures and potential confounders
1. (b) Indicate number of participants with missing data for each variable of interest
1. (c) Cohort study --- Summarise follow-up time (eg, average and total amount)
1. Outcome data
1. *Give information separately for cases and controls in case-control studies and, if applicable, for exposed and unexposed groups in cohort and cross-sectional studies.
1. Cohort study --- Report numbers of outcome events or summary measures over time
1. Case-control study --- Report numbers in each exposure category, or summary measures of exposure
1. Cross-sectional study --- Report numbers of outcome events or summary measures
1. Main results
1. Give unadjusted estimates and, if applicable, confounder-adjusted estimates and their precision (eg, 95% confidence interval). Make clear which confounders were adjusted for and why they were included
1. Report category boundaries when continuous variables were categorized
1. If relevant, consider translating estimates of relative risk into absolute risk for a meaningful time period
1. Other analyses
1. Report other analyses done --- eg analyses of subgroups and interactions, and sensitivity analyses
1. Discussion
1. Key results
1. Summarise key results with reference to study objectives
1. Limitations
1. Discuss limitations of the study, taking into account sources of potential bias or imprecision. Discuss both direction and magnitude of any potential bias
1. Interpretation
1. Give a cautious overall interpretation of results considering objectives, limitations, multiplicity of analyses, results from similar studies, and other relevant evidence
1. Generalisability
1. Discuss the generalisability (external validity) of the study results
1. Conclusion:
1. Summary of the main findings.
1. Implications of the study.
1. Suggestions for future research.
1. References:
1. List of all sources cited in the report, following a specific citation style (e.g., APA, MLA, Chicago).
1. Appendices (if applicable):
1. Supplementary materials such as raw data, additional tables or figures, questionnaires, etc.
1. Other information
1. Funding
1. Give the source of funding and the role of the funders for the present study and, if applicable, for the original study on which the present article is based
Note: An Explanation and Elaboration article discusses each checklist item and gives methodological background and published examples of transparent reporting. The STROBE checklist is best used in conjunction with this article (freely available on the Web sites of PLoS Medicine at http://www.plosmedicine.org/, Annals of Internal Medicine at http://www.annals.org/, and Epidemiology at http://www.epidem.com/). Information on the STROBE Initiative is available at www.strobe-statement.org.
--------------------------------------------------------------------------------
# Templates
## Figures
Here I crossreference the subfigures of the figure.
The main figure is @fig-charts, with the subpanels being called
@fig-charts-1 and @fig-charts-2, automatically.
```{r}
#| label: fig-charts
#| fig-cap: Two charts
#| fig-subcap:
#| - "Speed and Stopping Distances of Cars"
#| - "Vapor Pressure of Mercury as a Function of Temperature"
#| layout-ncol: 2
plot(cars)
plot(pressure)
```
Here I crossreference the subfigures of the figure.
The main figure is @fig-charts2, with the subpanels being called
@fig-charts2-1, @fig-charts2-2, and @fig-charts2-3, automatically.
```{r}
#| label: fig-charts2
#| fig-cap: Three charts
#| fig-subcap:
#| - "Speed and Stopping Distances of Cars"
#| - "Vapor Pressure of Mercury as a Function of Temperature"
#| - "Motor Trend Car Road Tests"
#| layout: [[45,-10, 45], [100]]
#| fig-width: 8
#| fig-height: 6
plot(cars)
plot(pressure)
plot(mtcars)
```
## Tables
Here I crossreference the subtables of the table.
The main table is @tbl-example, with the subpanels being called
@tbl-example-1 and @tbl-example-2, automatically.
```{r}
#| label: tbl-example
#| tbl-cap: "Example"
#| tbl-subcap:
#| - "Cars"
#| - "Pressure"
#| layout-ncol: 2
knitr::kable(head(cars))
knitr::kable(head(pressure))
```
## Equations
Black-Scholes (@eq-black-scholes) is a mathematical model that seeks to explain
the behavior of financial derivatives, most commonly options:
$$
\frac{\partial \mathrm C}{ \partial \mathrm t } + \frac{1}{2}\sigma^{2} \mathrm S^{2}
\frac{\partial^{2} \mathrm C}{\partial \mathrm C^2}
+ \mathrm r \mathrm S \frac{\partial \mathrm C}{\partial \mathrm S}\ =
\mathrm r \mathrm C
$$ {#eq-black-scholes}
## Crossreference sections {#sec-crossref-sections}
See @sec-crossref-sections for additional context.
## Crossreference code
To xref code <https://quarto.org/docs/authoring/cross-references.html>, it's a bit strange.
Create the label, then use .r, then a list caption.
Note that the code is not executed!
Then you can xref by the label (@lst-code-xref).
```{#lst-code-xref .r lst-cap="Code xref"}
seq(1, 10, by = 2)
```
## Block layout
::: {layout-ncol=2}
### List One
- Item A
- Item B
- Item C
### List Two
- Item X
- Item Y
- Item Z
:::
::: {layout-ncol=2}
- Item X
- Item Y
- Item Z
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur gravida eu
erat et fring. Morbi congue augue vel eros ullamcorper, eget convallis tortor
sagittis. Fusce sodales viverra mauris a fringilla. Donec feugiat, justo eu
blandit placerat, enim dui volutpat turpis, eu dictum lectus urna eu urna.
Mauris sed massa ornare, interdum ipsum a, semper massa.
:::
## Diagrams
See <https://quarto.org/docs/authoring/diagrams.html> and <https://mermaid-js.github.io/mermaid/#/flowchart>.
```{mermaid}
flowchart LR
A[Hard edge] --> B(Round edge)
B --> C{Decision}
C --> D[Result one]
C --> E[Result two]
```
## Margins and layout
See <https://quarto.org/docs/authoring/article-layout.html>.
Here is an inline footnote.^[Inlines notes are easy to write,
since you don't have to pick an identifier and move down to
type the note.]
[This is a span that has the class aside which places it in the margin without
a footnote number.]{.aside}
## Callouts
:::{.callout-note}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
:::{.callout-tip}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
:::{.callout-warning}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
:::{.callout-caution}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
:::{.callout-important}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
:::{.callout-caution collapse="true"}
## Expand To Learn About Collapse
This is an example of a 'folded' caution callout that can be expanded by the
user. You can use `collapse="true"` to collapse it by default or
`collapse="false"` to make a collapsible callout that is expanded by default.
:::
## Generate dynamic headers
```{r}
#| echo: false
#| output: asis
cat("### Dynamic Heading 1\n")
cat("### Dynamic Heading 2\n")
cat("### Dynamic Heading 3\n")
```
<!---
# part[short version ]{heading }
## chapter[short version ]{heading }
-->
# section[short version ]{heading }
## subsection[short version ]{heading }
### subsubsection[short version ]{heading }
#### paragraph[short version ]{heading }
##### subparagraph[short version ]{heading }
\appendix
# Appendix {.appendix}
## Acknowledgments {.appendix}
Sections of your document can be added to the Appendix that appears at the end
of your article by adding the .appendix class to any header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment