[R] readline() to vector
Torsten Hothorn
Torsten.Hothorn at rzmail.uni-erlangen.de
Fri Jan 18 16:19:10 CET 2002
> Hi!
>
> I'm trying to use readline() to ask for xlim() and ylim() values
> for a subsequent plot. I'm doing:
>
> lim <- readline("Enter xlim and ylim values: ")
>
> then would like to use the values in lim for a plot:
>
> plot(etc, xlim=lim[1:2],ylim=lim[3:4])
>
> The problem is that lim is a character,i.e.,
>
> "10,20,-10,50"
> or
> "c(10,20,-10,50)"
R> eval(parse(text="c(10,20,-10,50)"))
Torsten
>
> depending on the input to the readline request.
>
> My question is: how can I transform either "10,20,-10,50" or
> "c(10,20,-10,50)" into a numeric vector ?
>
> Thanks
>
> Agus
>
> Dr. Agustin Lobo
> Instituto de Ciencias de la Tierra (CSIC)
> Lluis Sole Sabaris s/n
> 08028 Barcelona SPAIN
> tel 34 93409 5410
> fax 34 93411 0012
> alobo at ija.csic.es
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list