speed = distance / time, and typos (#1402)
This commit is contained in:
parent
4be5b37d87
commit
9483bef03f
|
@ -105,7 +105,7 @@ This makes it easier to skim the code.
|
||||||
|
|
||||||
flights |>
|
flights |>
|
||||||
mutate(
|
mutate(
|
||||||
speed = air_time / distance,
|
speed = distance / air_time,
|
||||||
dep_hour = dep_time %/% 100,
|
dep_hour = dep_time %/% 100,
|
||||||
dep_minute = dep_time %% 100
|
dep_minute = dep_time %% 100
|
||||||
)
|
)
|
||||||
|
@ -151,7 +151,7 @@ flights |>
|
||||||
```
|
```
|
||||||
|
|
||||||
After the first step of the pipeline, indent each line by two spaces.
|
After the first step of the pipeline, indent each line by two spaces.
|
||||||
RStudio will automatically put the spaces in for you after a line break following a `\>` .
|
RStudio will automatically put the spaces in for you after a line break following a `|>` .
|
||||||
If you're putting each argument on its own line, indent by an extra two spaces.
|
If you're putting each argument on its own line, indent by an extra two spaces.
|
||||||
Make sure `)` is on its own line, and un-indented to match the horizontal position of the function name.
|
Make sure `)` is on its own line, and un-indented to match the horizontal position of the function name.
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ flights |>
|
||||||
group_by(dest) |>
|
group_by(dest) |>
|
||||||
summarize(
|
summarize(
|
||||||
distance = mean(distance),
|
distance = mean(distance),
|
||||||
speed = mean(air_time / distance, na.rm = TRUE)
|
speed = mean(distance / air_time, na.rm = TRUE)
|
||||||
) |>
|
) |>
|
||||||
ggplot(aes(x = distance, y = speed)) +
|
ggplot(aes(x = distance, y = speed)) +
|
||||||
geom_smooth(
|
geom_smooth(
|
||||||
|
@ -292,7 +292,7 @@ knitr::include_graphics("screenshots/rstudio-nav.png")
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
In this chapter, you've learn the most important principles of code style.
|
In this chapter, you've learned the most important principles of code style.
|
||||||
These may feel like a set of arbitrary rules to start with (because they are!) but over time, as you write more code, and share code with more people, you'll see how important a consistent style is.
|
These may feel like a set of arbitrary rules to start with (because they are!) but over time, as you write more code, and share code with more people, you'll see how important a consistent style is.
|
||||||
And don't forget about the styler package: it's a great way to quickly improve the quality of poorly styled code.
|
And don't forget about the styler package: it's a great way to quickly improve the quality of poorly styled code.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue