I use two vectors in a function to obtain x values that I need to plot.
I want to add the values of the vectors in the title. I've been using this code that works well but, as the length of the vectors change, I need to modify the code and add, lets say, p[2]
or q[3]
.
p=3
q=c(1,2)
x= c(1:10)
plot(x,main=paste("Process X","\n Values p=",p," ; q=",q[1],",",q[2]))
I've realized that using just the name of the vector (as for p in the example) with a vector p of length=2, I get 2 titles superposed (one for each value of the vector).
I also used substitute() before paste function. In that case, I used just vector names without the brackets and get c(1,2)
in the title which is ok for me but I don't know why substitute()
don't allow nor "\n" to split lines nor the bold format for the title.
Is there a way to get just the values of the vectors, independently of the length, and generate just one simple title?
Thanks for your help