Skip to content

Commit

Permalink
Fixing code that was spilling into the right margin (#170)
Browse files Browse the repository at this point in the history
* Fixing code that was spilling into the right margin

* Adjust style for long lines

---------

Co-authored-by: Stephanie Zimmer <[email protected]>
  • Loading branch information
rpowell22 and szimmer authored Aug 23, 2024
1 parent ec349b6 commit 1630dc7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
8 changes: 6 additions & 2 deletions 07-modeling.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,9 @@ Let's first look at the main effects of income grouping and early voting behavio
```{r}
#| label: model-logisticexamp-biden-main
log_biden_main <- anes_des_ind %>%
mutate(EarlyVote2020 = fct_relevel(EarlyVote2020, "No", after = 0)) %>%
mutate(
EarlyVote2020 = fct_relevel(EarlyVote2020, "No", after = 0)
) %>%
svyglm(
design = .,
formula = VoteBiden ~ EarlyVote2020 + Income7,
Expand Down Expand Up @@ -716,7 +718,9 @@ Although early voting behavior was not significant, there may be an interaction
```{r}
#| label: model-logisticexamp-biden-int
log_biden_int <- anes_des_ind %>%
mutate(EarlyVote2020 = fct_relevel(EarlyVote2020, "No", after = 0)) %>%
mutate(
EarlyVote2020 = fct_relevel(EarlyVote2020, "No", after = 0)
) %>%
svyglm(design = .,
formula = VoteBiden ~ (EarlyVote2020 + Income7)^2,
family = quasibinomial)
Expand Down
16 changes: 12 additions & 4 deletions 08-communicating-results.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ We can add a few more enhancements, such as a title (which is different from a c
trust_gov_gt2 <- trust_gov_gt %>%
tab_header("American voter's trust
in the federal government, 2020") %>%
tab_source_note(md("*Source*: American National Election Studies, 2020")) %>%
tab_source_note(
md("*Source*: American National Election Studies, 2020")
) %>%
tab_footnote(
"Question text: How often can you trust the federal government
in Washington to do what is right?"
Expand Down Expand Up @@ -309,7 +311,9 @@ anes_des_gtsum3 <- anes_des %>%
as_gt() %>%
tab_header("American voter's trust
in the federal government, 2020") %>%
tab_source_note(md("*Source*: American National Election Studies, 2020")) %>%
tab_source_note(
md("*Source*: American National Election Studies, 2020")
) %>%
tab_footnote(
"Question text: How often can you trust the federal government
in Washington to do what is right?"
Expand Down Expand Up @@ -356,7 +360,9 @@ anes_des_gtsum4 <- anes_des %>%
as_gt() %>%
tab_header(
"American voter's trust in the federal government, 2020") %>%
tab_source_note(md("*Source*: American National Election Studies, 2020")) %>%
tab_source_note(
md("*Source*: American National Election Studies, 2020")
) %>%
tab_footnote(
"Question text: How often can you trust the federal government
in Washington to do what is right?"
Expand Down Expand Up @@ -408,7 +414,9 @@ anes_des_gtsum5 <- anes_des %>%
in the federal government by whether they voted
in the 2020 presidential election"
) %>%
tab_source_note(md("*Source*: American National Election Studies, 2020")) %>%
tab_source_note(
md("*Source*: American National Election Studies, 2020")
) %>%
tab_footnote(
"Question text: How often can you trust the federal government
in Washington to do what is right?"
Expand Down
11 changes: 7 additions & 4 deletions 13-ncvs-vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -883,12 +883,15 @@ vr_gt<-pers_est_df %>%
locations = cells_stub(rows = Level == "Other")
) %>%
tab_source_note(
source_note = md("*Note*: Rates per 1,000 persons age 12 or older.")) %>%
tab_source_note(source_note = md("*Source*: Bureau of Justice Statistics,
National Crime Victimization Survey, 2021.")) %>%
source_note = md("*Note*: Rates per 1,000 persons age 12 or older.")
) %>%
tab_source_note(
source_note = md("*Source*: Bureau of Justice Statistics,
National Crime Victimization Survey, 2021.")
) %>%
tab_stubhead(label = "Victim Demographic") %>%
tab_caption("Rate and standard error of violent victimization,
by type of crime and demographic characteristics, 2021")
by type of crime and demographic characteristics, 2021")
```


Expand Down
4 changes: 3 additions & 1 deletion 90-AppendixA-DataImport.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ SAS:
library(haven)

anes_sas <-
read_sas(data_file = "data/anes_timeseries_2020_sas_20220210.sas7bdat")
read_sas(
data_file = "data/anes_timeseries_2020_sas_20220210.sas7bdat"
)
```

### Working with labeled data
Expand Down

0 comments on commit 1630dc7

Please sign in to comment.