I have a function with two input variables
min.depth<-2
max.depth<-5
the function produces a plot. How can I insert the input variables into the title?
I have tried:
plot.a<-plot(plt.a$"Traits",plt.a$"Species",xlab="Site similarity by traits (Tsim)",
ylab="Site similarity by species (Jaccard)",
main=c("Jaccard vs. Tsim for depths", min.depth, "to",max.depth,"m")
While this does insert the input variable correctly it also causes the title to stack as follows:
Jaccard vs. Tsim for depths
2
to
5
m
Any ideas on how to avoid this stacking?
You should use paste
instead of c
:
plot(..., main=paste("Jaccard vs. Tsim for depths", min.depth, "to",max.depth,"m", sep=" "))
With c
you create a vector of strings (hence the stacking), with paste
you concatenate them into one single string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With