[R] Rule for accessing attributes?

hadley wickham h.wickham at gmail.com
Thu Mar 27 14:00:20 CET 2008


>  xydf <- data.frame(x = 1:5, y = 11:15)
>  plt <- ggplot(data = xydf, aes(x = x,y = y)) + geom_point()
>  attributes(plt)
>
>  Now we can change the title:
>
>  plt$title <- "My Title"
>  plt

This is rather poorly documented, but the preferred way of setting the
title is now:

p + opts(title = "My Title")

All options should be documented under ?opts (but aren't, unfortunately).

Hadley
-- 
http://had.co.nz/



More information about the R-help mailing list