Hello,
I tried to make series of plots from two tibbles (the example is using mtcars only) and I've found that map creates vectors without names. I have no idea how to set xlab and ylab names (based on column names in the tibble) in this case...
Can you help?
a <- function(.x,.y){
o <- ggplot() +
geom_point(aes(x = .x, y = .y))+
geom_smooth(aes(x = .x, y = .y), method = lm, se=FALSE)+
labs(y=names(.y), x=names(.x), title="pozn a obj")
print(o)
}
for (i in 1:2 ){
map2(as_tibble(mtcars[,i]), mtcars, a)
}