Skip to content

Commit

Permalink
Merge pull request #105 from tidy-survey-r/add-styler
Browse files Browse the repository at this point in the history
Add styler chunks to the beginning of each chapter.
  • Loading branch information
ivelasq authored Mar 11, 2024
2 parents 02bcccb + a1baef9 commit 75f2c57
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions 05-descriptive-analysis.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Descriptive Analyses in {srvyr} {#c05-descriptive-analysis}

```{r}
#| label: desc-styler
#| include: false
knitr::opts_chunk$set(tidy = 'styler')
```

::: {.prereqbox-header}
`r if (knitr:::is_html_output()) '### Prerequisites {- #prereq5}'`
:::
Expand Down
6 changes: 6 additions & 0 deletions 07-modeling.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Modeling {#c07-modeling}

```{r}
#| label: model-styler
#| include: false
knitr::opts_chunk$set(tidy = 'styler')
```

::: {.prereqbox-header}
`r if (knitr:::is_html_output()) '### Prerequisites {- #prereq7}'`
:::
Expand Down
1 change: 1 addition & 0 deletions 08-communicating-results.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Communicating results {#c08-communicating-results}

```{r}
#| label: results-styler
#| include: false
knitr::opts_chunk$set(tidy = 'styler')
```
Expand Down
4 changes: 3 additions & 1 deletion 09-reproducible-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#| include: false
knitr::opts_chunk$set(tidy = 'styler')
```

## Introduction

Reproducing a data analysis's results is a crucial aspect of any research. First, reproducibility serves as a form of quality assurance. If we pass an analysis project to another person, they should be able to run the entire project from start to finish and obtain the same results. They can critically assess the methodology and code while detecting potential errors. Another goal of reproducibility is enabling the verification of our analysis. When someone else is able to check our results, it ensures the integrity of the analyses by determining that the conclusions are not dependent on a particular person running the code or workflow on a particular day or in a particular environment.

Not only is reproducibility a key component in ethical and accurate research, but it is also a requirement for many scientific journals. For example, the Journal of Survey Statistics and Methodology (JSSAM) and Public Opinion Quarterly (POQ) require authors to make code, data, and methodology transparent and accessible to other researchers who wish to verify or build on existing work.
Expand Down Expand Up @@ -52,7 +54,7 @@ In a project-based workflow, all paths are relative and, by default, relative to

```{r}
#| eval: false
#| label: project-file-example
#| label: reprex-project-file-example
anes <-
read_csv(here::here("data", "anes2020_clean.csv"))
```
Expand Down
6 changes: 6 additions & 0 deletions 92-AppendixC.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Importing survey data into R

```{r}
#| label: readr-styler
#| include: false
knitr::opts_chunk$set(tidy = 'styler')
```

To analyze a survey, we need to import the survey data into R. This process is often referred to as importing, loading, or reading in data. Survey files come in different formats depending on the software used to create them. One of the many advantages of R is the flexibility in handling various data formats, regardless of their file extensions. Here are examples of common public-use survey file formats we may encounter:

* Delimiter-separated text files
Expand Down

0 comments on commit 75f2c57

Please sign in to comment.