+4 votes
in Programming Languages by (16.6k points)
I am generating some plots in R and want to put the value of a variable in the plot's title so that I can differentiate plots. If I put the variable name in the argument "main," it does not show its value. How can I put the value of the variable in the title of the plot?

1 Answer

0 votes
by (33.0k points)

You can use the paste() function in "main" to show the value of the variable instead of its name.

Here is an example to show the value of variable "v":

scatter.smooth(x,y, main=paste("Value of the variable is", v))

...