When labelling axis ticks I'd like to add other information from the dataframe in parentheses. For example, using code snippet below I'd like to automatically include the information on Area in parentheses next to the label X. In other words, the label might say 'Chicago (45)' instead of just 'Chicago'. I know I can do this manually by setting labels in scale_x_discrete. However, can I do this automatically? My dataset has a large number of entries so I would like to avoid doing this manually.
dataset <- data.frame(Area = sample(c(NA, 1:100), 3, rep = TRUE),
Y = rnorm(3), X = c("Chicago","New York", "Orlando"))
ggplot(dataset, aes(X, Y)) + geom_point()
aes(paste0(X, "\n(", round(Area), ")"), Y)