@ Sarah
Thanks a lot, paste does the job perfectly!

On 09/07/2014 17:46, Sarah Goslee wrote:
How about:


plot(dd$Sepal.Length, dd$Petal.Length, main=paste("These are the
levels:", paste(levels(dd$Species), collapse=", ")))


Thanks for the actual reproducible example!

Sarah

On Wed, Jul 9, 2014 at 11:24 AM, Bea GD <aguitatie...@hotmail.com> wrote:
Hi all,

I'd like to include the levels of one of my variables in the title of a
plot. I'd like these factor levels to be concatenated. E.g. 'These are the
levels: setosa, versicolor, virginica'.

I've been working with this code but I don't get the desired results. Any
suggestions would be a great help. Thanks!

dd <- iris

plot(dd$Sepal.Length, dd$Petal.Length,
      main=sprintf("These are the levels: %s", levels(dd$Species)))


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to