Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ismayc committed Oct 25, 2024
1 parent 6809bf4 commit 1a2aaed
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions day4_walkthrough_answers.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,23 @@ theory_p_value <- null_distro_t |>
theory_p_value
```

**Bonus**: This can also be done directly in R, but requires us to change the
format of the data a little bit. We have a `t_test()` function in `infer` that
wraps the data, so we don't have to do this extra step.
**Bonus**: This can also be done directly in R, but unfortunately the formula
notation isn't available for all tests in the `stats` package.

```{r}
# Conduct the t-test directly
adelie_chinstrap_data |>
t.test(formula = body_mass_g ~ species,
# Can use the _ to pass into arguments when they aren't the first one
data = _,
alternative = "two.sided")
```

We have a `t_test()` function in `infer` that follows a common framework across
all tests that are implemented.

```{r}
# Can use one of the `infer` wrapper functions too
adelie_chinstrap_data |>
t_test(formula = body_mass_g ~ species,
order = c("Adelie", "Chinstrap"),
Expand Down

0 comments on commit 1a2aaed

Please sign in to comment.