Re: [R] Error when modifying names of the object returned by get()

2011-02-15 Thread Hadley Wickham
> 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 co

Re: [R] Error when modifying names of the object returned by get()

2011-02-15 Thread Duncan Murdoch
On 15/02/2011 11:43 AM, John Edwards wrote: I get the following error when I try to modify the names of the object returned by get(). Does anybody know how to do so? (I could use as.vector() to remove the names, but I'm interested in how to modify the object returned by get().) You can probably

Re: [R] Error when modifying names of the object returned by get()

2011-02-15 Thread Ista Zahn
Hi John, Probably there is a more elegent solution, but I usually do something like tmp <- get("x") names(tmp) <- letters[1:10] assign("x", tmp) rm("tmp") HTH, Ista On Tue, Feb 15, 2011 at 11:43 AM, John Edwards wrote: > I get the following error when I try to modify the names of the object > r