In R we can make a function return more than one object through a list. But how do you assign these objects to two different variables?
Example:
f<-function(){
primeiro<-1:10
segundo<-11:21
return (list(primeiro,segundo))
}
With the above function I can assign and access the objects as follows.
d<-f()
d[1]
d[2]
But I can not assign these values to distinct variables through a list
list(a,b)<-f()
I want to assign to each variable: a and b one of the result objects of the f () function. The equivalent in Python would be:
def f():
primeiro=range(1,11)
segundo=range(11,20)
return (primeiro,segundo)
(a,b)=f()
print a
print b