I am using curly curly using in labs in ggplot, it doesn't seem to work, how to use the label on the labs in ggplot in Try #2. For Try#3 I want to pass all numeric variable through purr in the function.
TRY #1 - This works
library(tidyverse)
myplot <- function(df,col) {
df %>%
ggplot(aes(x={{col}}))+
geom_histogram()+
# labs(title=paste0("Histogram for ",{{col}}))+
theme_classic()
}
myplot(iris,Sepal.Length)
TRY #2 - This doesnt work
myplot <- function(df,col) {
df %>%
ggplot(aes(x={{col}}))+
geom_histogram()+
labs(title=paste0("Histogram for ",{{col}}))+
theme_classic()
}
myplot(iris,Sepal.Length)
TRY #3 - This doesnt work either
myplot <- function(df,col) {
df %>%
ggplot(aes(x={{col}}))+
geom_histogram()+
theme_classic()
}
iris[,-5] %>%
map(myplot)


