I have a function whose only objective is to produce a bar graph. My dataset is called south.
# ......................................................................................
# Data for my example
south = matrix(data = sample(x = c("A","B","C"), size = 1032, replace = T), ncol = 12)
# ......................................................................................
# Function to graph the count of 'A', 'B', and 'C' from 'data'
graphMaker = function(system){
system %>%
as.data.frame() %>%
gather(key = "Key", value = "Values") %>%
ggplot(aes(Values, fill = Values)) +
geom_bar() +
labs(title = ________________)
}
# ......................................................................................
How do I get my graph's title to be string I supplied to my function's argument
system?
If I try labs(title = system), I get a graph whose title is "C".
Ultimately, that's what I want my graph to look like.

Just use substitute
labs(title = substitute(system))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With