Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise Exercise 5.7.6 wrong formula or description used #595

Open
persep opened this issue Mar 7, 2021 · 0 comments
Open

Exercise Exercise 5.7.6 wrong formula or description used #595

persep opened this issue Mar 7, 2021 · 0 comments

Comments

@persep
Copy link

persep commented Mar 7, 2021

In Exercise 5.7.6 after the fisrt section of code it says

I add 1 to the denominator and numerator to avoid dividing by zero

But the code used only has 1 added to the denominator

standardized_flights <- flights %>%
  filter(!is.na(air_time)) %>%
  group_by(dest, origin) %>%
  mutate(
    air_time_mean = mean(air_time),
    air_time_sd = sd(air_time),
    n = n()
  ) %>%
  ungroup() %>%
  mutate(air_time_standard = (air_time - air_time_mean) / (air_time_sd + 1))

Anyway sd can never be zero for an object of length > 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant