[R] Create variable by name

Greg Snow Greg.Snow at imail.org
Wed Oct 6 19:24:13 CEST 2010


Possible? Yes (as others have shown), advisable? No, see fortune(106), fortune(236), and possibly fortune(181).

What is your ultimate goal? Maybe we can help you find a better way.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Ralf B
> Sent: Wednesday, October 06, 2010 10:32 AM
> To: r-help Mailing List
> Subject: [R] Create variable by name
> 
> Can one create a variable through a function by name
> 
> createVariable <- function(name) {
> 	outputVariable = name
> 	name <- NULL
> }
> 
> after calling
> 
> createVariable("myVar")
> 
> I would like to have a variable myVar initialized with NULL in my
> environment. Is this possible?
> 
> Ralf
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list