Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b47bfe9

Browse files
committed
updating NSE syntax
1 parent 0794021 commit b47bfe9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎lecture_notes/03_map_glue.Rmd‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ glue("{names} studies {fields}.")
8282
How can you create the character vector of column names?
8383

8484
**Challenge 2**
85-
How can make `ggplot2()` take strings as x and y variable names? (Hint: Type `?aes_string()`)
85+
How can make `ggplot2()` take strings as x and y variable names?
8686

87-
```{r}
87+
```{r, warning = F, message = F}
8888
8989
airquality %>%
90-
ggplot(aes_string(x = names(airquality)[1], y = names(airquality)[2])) +
91-
geom_point()+
90+
ggplot(aes(x = .data[[names(airquality)[1]]], y = .data[[names(airquality)[2]]]))+
91+
geom_point()+
9292
labs(title = glue("Relationship between Ozone and {names(airquality)[2]}"),
9393
y = glue("{names(airquality)[2]}"))
9494
@@ -103,7 +103,7 @@ airquality %>%
103103
create_point_plot <- function(i){
104104
105105
airquality %>%
106-
ggplot(aes_string(x = names(airquality)[1], y = names(airquality)[i])) +
106+
ggplot(aes(x = .data[[names(airquality)[1]]], y = .data[[names(airquality)[i]]]))+
107107
geom_point() +
108108
labs(title = glue("Relationship between Ozone and {names(airquality)[i]}"),
109109
y = glue("{names(airquality)[i]}"))
@@ -114,7 +114,7 @@ create_point_plot <- function(i){
114114

115115
- The final step is to put the function in `map()`.
116116

117-
```{r}
117+
```{r, message = F, warning = F}
118118
119119
map(2:ncol(airquality), create_point_plot)
120120

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /