Reputation: 347
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.
Upvotes: 3
Views: 238