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 know
how to refer to this generically (the object "name"? I tried
as.name(s1) but that returns the first element of the vector).

So I want something like :

myplot <- function(subject) { plot(subject,main=X) }

where X is the expression I'm looking for, and the plot should have the title
"s1" if I've called myplot(s1), "s2" if myplot(s2), etc.

I'm sure I'll be really embarrassed that this is so trivial but I
cannot figure it out.


Marianne

-- 
Marianne Promberger PhD
King's College London

______________________________________________
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