I'm new to R and wondering if the following is possible to calculation in the title of a ggplot scatter. The code below is how I thought it might be possible.
AlexPlot + ggtitle("Alex's BG, The average is " + mean(Alex$bg, na.rm = TRUE))
I'm new to R and wondering if the following is possible to calculation in the title of a ggplot scatter. The code below is how I thought it might be possible.
AlexPlot + ggtitle("Alex's BG, The average is " + mean(Alex$bg, na.rm = TRUE))
Copyright © 2021 Jogjafile Inc.
Since you haven't shared your data, I am using
mpgdataset; you need to wrap the text and the numeric calculation withinpastefunction. The comment above works as well, but I am not sure why we need to usepaste0twice!As you can see, this works. You need to share a reproducible example of your data, if you get an error related to your specific data.