Re: [R] get function to return object "name"?

2009-09-02 Thread baptiste auguie
Hi, Try this, myplot <- function(subject) { plot(subject, main=deparse(substitute(subject))) } s1 <- c(200,200,190,180) myplot(s1) see ?deparse HTH, baptiste 2009/9/2 Marianne Promberger > Dear list, > > I've written a function that plots subjects. Something like: > > myplot <- functi

[R] get function to return object "name"?

2009-09-02 Thread Marianne Promberger
Dear list, I've written a function that plots subjects. Something like: myplot <- function(subject) { plot(subject) } Subjects are vectors, e.g. ... s1 <- c(200,200,190,180) ... and plotting them works fine, e.g. ... myplot(s1) Now I want to have "s1" etc appear in the plot title, but I don't