I want to plot only once the text of the mean for the specific cluster.
but what I want is this:
code for reproduction:
price_l <- rep(c('€€-€€€', '€€-€€€', '€€€€', '€€-€€€', '€€-€€€',
'€€-€€€', '€€€€', '€€-€€€', '€€€€', '€€-€€€',
'€€-€€€', '€€-€€€', '€€-€€€', '€€-€€€',
'€€-€€€', '€€-€€€', '€€-€€€', '€€-€€€', '€€€€','€', '€',
'€', '€','€€€€', '€'),100)
avg_r <- rep(c(4.5, 3.5, 4.0, 4.0, 4.0, 3.5, 4.5, 4.0, 3.0, 4.0,
3.0, 5.0, 4.5, 4.0, 3.0,
3.5, 4.5, 3.5, 3.5, 4.0, 3.0, 4.0, 4.0, 2.5, 4.5),100)
sub.df <- data.frame(price_l, avg_r)
sub.df %>%
group_by(price_l) %>%
mutate(mean = mean(avg_r)) %>%
ungroup() %>%
ggplot(sub.df, mapping=aes(price_l, avg_r), na.rm=T) +
geom_jitter(aes(colour = price_l)) +
geom_text(aes(label = sprintf("%.2f",mean)))





