[R] quote supression
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sat Mar 15 01:44:45 CET 2003
"Jeremy Z Butler" <jerrytheshrub at hotmail.com> writes:
> To creat a series of plots I've constructed the following, however
> this doesn't work because the colnames being feed into n are embraced
> by quotes which is stuffing up the plotting function. Is there a way
> to suppress to quotes? coercion in to a different format??
>
> for (n in colnames(tt[7:36]))
> {
> par(ask=T)
> attach(tt)
> plot(july~n)
> ...
> }
[You're adding tt to the search list 30 times that way. I don't think
you want that... Also, what is tt? If a matrix then you'd probably
need tt[,7:36] ]
This is difficult to do cleanly. One reasonable way might be
for (i in 7:36)
plot(july~tt[,i],xlab=colnames(tt)[i])
If you insist on following your original strategy you end up with
something like
eval(substitute(plot(july~n),list(n=as.name(n))))
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list