Peter Dalgaard <[EMAIL PROTECTED]> writes:
> > > scatter.plot <- function (data, x, y) {
> > > plot(data$x, data$y)
> > > }
> >
> > Use
> > plot(data[[x]], data[[y]])
> > instead
>
> The plot labels won't come out right then. I think David was
> looking for something like
>
> function(data, x, y)
> eval(substitute(plot(x,y)), data)
>
> or to be able to pass names:
>
> function(data, x, y)
> eval(substitute(plot(x,y),list(x=as.name(x), y=as.name(y))), data)
...On the other hand, come to think of it, there's quite a lot to be
said for just doing
plot(data[[x]], data[[y]], xlab=x, ylab=y)
at least in the latter case. (The former has the advantage that you
can pass in entire expressions.)
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html