Skip to content

Commit

Permalink
Chapter 04: Remove italics (#161)
Browse files Browse the repository at this point in the history
* Remove italics

* Small edit
  • Loading branch information
ivelasq authored Aug 20, 2024
1 parent 9785c70 commit 18d6e34
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions 04-set-up.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Note that the {censusapi} package requires a Census API key, available for free
```{r}
#| label: setup-census-api-setup
#| eval: FALSE
Sys.setenv(CENSUS_KEY="YOUR_API_KEY_HERE")
Sys.setenv(CENSUS_KEY = "YOUR_API_KEY_HERE")
```

Then, restart the R session. Once the Census API key is stored, we can retrieve it in our R code with `Sys.getenv("CENSUS_KEY")`.
Expand Down Expand Up @@ -287,7 +287,7 @@ There is a general process for analyzing data to create estimates with {srvyr} p

4. Within `summarize()`, specify variables to calculate, including means, totals, proportions, quantiles, and more

In Section \@ref(setup-des-obj), we follow Step 1 to create the survey design objects for the ANES and RECS data featured in this book. Additional details on how to create design objects can be found in Chapter \@ref(c10-sample-designs-replicate-weights). Then, once we have the design object, we can filter the data to any subpopulation of interest (if needed). It is important to filter the data **after** creating the design object. This ensures that we are accurately accounting for the survey design in our calculations. Finally, we can use `group_by()`, `summarize()`, and other functions from the {survey} and {srvyr} packages to analyze the survey data by estimating means, totals, and so on.
In Section \@ref(setup-des-obj), we follow Step 1 to create the survey design objects for the ANES and RECS data featured in this book. Additional details on how to create design objects can be found in Chapter \@ref(c10-sample-designs-replicate-weights). Then, once we have the design object, we can filter the data to any subpopulation of interest (if needed). It is important to filter the data after creating the design object. This ensures that we are accurately accounting for the survey design in our calculations. Finally, we can use `group_by()`, `summarize()`, and other functions from the {survey} and {srvyr} packages to analyze the survey data by estimating means, totals, and so on.

\index{Survey analysis process|)}\index{Design object|)}

Expand Down Expand Up @@ -357,7 +357,7 @@ The functions in {srvyr} also play nicely with other tidyverse functions. For ex
#| label: setup-dplyr-select
towny %>%
summarize(across(starts_with("population"),
~mean(.x, na.rm=TRUE)))
~mean(.x, na.rm = TRUE)))
```

```{r}
Expand Down Expand Up @@ -402,7 +402,7 @@ apistrat_des %>%
api00_median = survey_median(api00))
```

At this time, the `.by` argument is `srvyr::summarize()` does not exist as it does in {dplyr}. An alternative way to do the grouped analysis on the `towny` data would be:
An alternative way to do grouped analysis on the `towny` data would be with the `.by` argument:

```{r}
#| label: setup-dplyr-by-alt
Expand All @@ -420,7 +420,7 @@ However, the `.by` syntax is not yet available in {srvyr}:
apistrat_des %>%
summarize(api00_mean = survey_mean(api00),
api00_median = survey_median(api00),
.by=stype)
.by = stype)
```
\index{Functions in srvyr!survey\_median|)}

Expand Down

0 comments on commit 18d6e34

Please sign in to comment.