At this point, the function would only return the names because unless
specified otherwise they return the result of the last evaluation. Add
another line with just "a" and assign the results of the function to
something:
> testold=function(){
+ assign("a",c(1,2,3),env=.GlobalEnv)
+ names(a
If I assign a variable in a function, as in:
test=function(){
assign("a",c(1,2,3),env=.GlobalEnv)
}
How can I do the equivalent of:
names(a)=c("one","two","three")
within the function?
Merely adding the call to names does not work within the function as
it only affects a local variable:
t
2 matches
Mail list logo