On Wed, Oct 6, 2010 at 9:32 AM, Ralf B <ralf.bie...@gmail.com> wrote:
> 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?

A clean solution is to use the function assign where you can specify
the environment more precisely.

look at ?assign

Peter

______________________________________________
R-help@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.

Reply via email to