I´m trying to make a filter for the labels in a ggplot
Here is my initial ggplot
library(tidyverse)
library(gapminder)
data("gapminder")
gapminder %>%
filter(year == 2007) %>%
ggplot(aes(x = gdpPercap, y = lifeExp, color = continent))+
geom_point() -> A
My limit value
limit_value <- 70
gapminder %>%
filter(year == 2007) %>%
subset(lifeExp> limit_value) -> my_labels
I want to do it using ifelse
A +
geom_text((aes(label = ifelse(lifeExp > limit_value, my_labels$country,""))))
In the variable labels$country I have the name of each country but I get this instead of the names.
Any help?