An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20041117/1b4dc83f/attachment.pl
referencing values of strings
6 messages · Apoian, Zack, Dimitris Rizopoulos, Brian Ripley +3 more
get("x") see also r-FAQ 7.21
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Apoian, Zack" <Zack.Apoian at sac.com>
To: "'R-help at lists.R-project.org'" <R-help at stat.math.ethz.ch>
Sent: Wednesday, November 17, 2004 4:48 PM
Subject: [R] referencing values of strings
Say you have a vector named x and a function which returns the
character
string "x" . How would I take "x" as an input and return the vector
x?
DISCLAIMER: This e-mail message and any attachments are
inte...{{dropped}}
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On Wed, 17 Nov 2004, Apoian, Zack wrote:
Say you have a vector named x and a function which returns the character string "x" . How would I take "x" as an input and return the vector x?
?get
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
"get" is your friend: R> x <- c( 1, 2, 3 ) R> get( "x" ) [1] 1 2 3 All the best, Arne
On Wednesday 17 November 2004 16:48, Apoian, Zack wrote:
Say you have a vector named x and a function which returns the character
string "x" . How would I take "x" as an input and return the vector x?
DISCLAIMER: This e-mail message and any attachments are inte...{{dropped}}
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 ahenningsen at agric-econ.uni-kiel.de http://www.uni-kiel.de/agrarpol/ahenningsen/
On Wed, Nov 17, 2004 at 10:48:46AM -0500, Apoian, Zack wrote:
Say you have a vector named x and a function which returns the character string "x" . How would I take "x" as an input and return the vector x?
get("x")
See ?get. You may also be interested in ?assign.
+ seth
On Wed, 2004-11-17 at 10:48 -0500, Apoian, Zack wrote:
Say you have a vector named x and a function which returns the character string "x" . How would I take "x" as an input and return the vector x?
If I am understanding you correctly: x <- 1:10
x
[1] 1 2 3 4 5 6 7 8 9 10 x.char <- "x"
get(x.char)
[1] 1 2 3 4 5 6 7 8 9 10 See ?get for more information. HTH, Marc Schwartz