> You can probably do this by constructing a call to the `names<-` replacement
> function, but it's really bad style.  Don't write R code that has external
> side effects if you can avoid it.  In this case, you'll almost certainly get
> more maintainable code by writing your function to return a copy of x with
> new names, rather than trying to modify the original.

And for that task, you might find setNames useful: "It is most useful
at the end of a function definition where one is creating the object
to be returned and would prefer not to store it under a name just so
the names can be assigned."

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
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