-
Notifications
You must be signed in to change notification settings - Fork 105
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
fix and unify small issues #236
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -38,7 +38,8 @@ If the arguments to a ggplot2 layer don't all fit on one line, put each argument | |||||||
|
||||||||
```{r} | ||||||||
# Good | ||||||||
ggplot(aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + | ||||||||
iris |> | ||||||||
ggplot(aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + | ||||||||
geom_point() + | ||||||||
labs( | ||||||||
x = "Sepal width, in cm", | ||||||||
|
@@ -47,7 +48,7 @@ ggplot(aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + | |||||||
) | ||||||||
|
||||||||
# Bad | ||||||||
ggplot(aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + | ||||||||
iris |> ggplot(aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to make the only 'bad' aspect the one about arguments on a long line.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. totally fine what you suggest |
||||||||
geom_point() + | ||||||||
labs(x = "Sepal width, in cm", y = "Sepal length, in cm", title = "Sepal length vs. width of irises") | ||||||||
``` | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ | |
|
||
Use `|>` to emphasise a sequence of actions, rather than the object that the actions are being performed on. | ||
|
||
The tidyverse has been designed to work particuarly well with the pipe, but you can use it with any code, particularly in conjunction with the `_` placeholder. | ||
The tidyverse has been designed to work particularly well with the pipe, but you can use it with any code, particularly in conjunction with the `_` placeholder. | ||
|
||
```{r} | ||
strings |> | ||
str_replace("a", "b"), | ||
str_replace("a", "b") |> | ||
str_replace("x", "y") | ||
|
||
strings |> | ||
|
@@ -32,12 +32,12 @@ Avoid using the pipe when: | |
# Good | ||
iris |> | ||
summarize(across(where(is.numeric), mean), .by = Species) |> | ||
pivot_longer(-Species, names_to = "measure", values_to = "value") |> | ||
pivot_longer(!Species, names_to = "measure", values_to = "value") |> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it works, but I feel |
||
arrange(value) | ||
|
||
# Bad | ||
iris |> summarize(across(where(is.numeric), mean), .by = Species) |> | ||
pivot_longer(-Species, names_to = "measure", values_to = "value") |> | ||
pivot_longer(!Species, names_to = "measure", values_to = "value") |> | ||
arrange(value) | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Syntax | ||
|
||
## Object names | ||
## Object names {#sec-objectnames} | ||
|
||
> "There are only two hard things in Computer Science: cache invalidation and | ||
> naming things." | ||
|
@@ -157,7 +157,7 @@ There are a few exceptions, which should never be surrounded by spaces: | |
x <- 1 : 10 | ||
``` | ||
|
||
* Single-sided formulas when the right-hand side is a single identifier: | ||
* Single-sided formulas when the right-hand side is a single identifier. | ||
|
||
```{r} | ||
# Good | ||
|
@@ -175,7 +175,7 @@ There are a few exceptions, which should never be surrounded by spaces: | |
) | ||
``` | ||
|
||
Note that single-sided formulas with a complex right-hand side do need a space: | ||
Note that single-sided formulas with a complex right-hand side do need a space. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am fine with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just thought it would be in the spirit of things to make it uniform for all consecutive bullet points |
||
|
||
```{r} | ||
# Good | ||
|
@@ -186,7 +186,7 @@ There are a few exceptions, which should never be surrounded by spaces: | |
``` | ||
|
||
* When used in tidy evaluation `!!` (bang-bang) and `!!!` (bang-bang-bang) | ||
(because have precedence equivalent to unary `-`/`+`) | ||
(because they have precedence equivalent to unary `-`/`+`). | ||
|
||
```{r} | ||
# Good | ||
|
@@ -198,7 +198,7 @@ There are a few exceptions, which should never be surrounded by spaces: | |
call(! !xyz) | ||
``` | ||
|
||
* The help operator | ||
* The help operator. | ||
|
||
```{r} | ||
# Good | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this reference work? I would have expected maybe
[object names](syntax#sec-objectnames)
instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added {#sec-objectnames} accordingly, but linking is also good