Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jimrothstein committed Jan 13, 2025
1 parent dfdd7db commit fc923f7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion NSE_project/010_mtcars_basic.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,24 @@ options(old)
getOption("digits")
```

### ggplot, using symbols, !!! in aes()
```{r}
library(ggplot2)
# works
ggplot(mtcars, aes(hp, mpg)) +
geom_point()
# and this works!
arg1 = as.symbol("hp")
arg2 = as.symbol("mpg")
ggplot(mtcars, aes(x = !!arg1, y=!!arg2)) +
geom_point()
# so does this!
l = list(x=arg1, y=arg2)
ggplot(mtcars, aes(!!!l)) +
geom_point()
```

vim:conceallevel=0

0 comments on commit fc923f7

Please sign in to comment.