Displaying 1 result from an estimated 1 matches for "main_get_name_assign".
2011 Feb 15
2
Error when modifying names of the object returned by get()
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().)
$ cat main_get_name_assign.R
x=1:10
names(x)=letters[1:10]
names(get('x'))=LETTERS[1:10]
#names(x)=LETTERS[1:10]
x
$ Rscript main_get_name_assign.R
> x=1:10
> names(x)=letters[1:10]
>
> names(get('x'))=LETTERS[1:10]
Error in names(get("x")) = LETTERS[1:10] :
target of assignment expa...