+5 votes
in Programming Languages by (71.8k 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

+2 votes
by (353k points)
selected by
 
Best answer

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))

Related questions

+2 votes
1 answer
+3 votes
1 answer
+5 votes
1 answer
+3 votes
1 answer
+3 votes
1 answer

...