In python it is possible to decompose a list
x=[1,2,3]
a,b,c=x # a=1 b=2 c=3
is it possible to do something similar in R? for example something like:
x=matrix(rnorm(100),10,10)
[u d v]=svd(x) # instead of u=svd$u d=svd$d v=svd$v
In python it is possible to decompose a list
x=[1,2,3]
a,b,c=x # a=1 b=2 c=3
is it possible to do something similar in R? for example something like:
x=matrix(rnorm(100),10,10)
[u d v]=svd(x) # instead of u=svd$u d=svd$d v=svd$v
Not without some hackery and fiddly global assignment, and my personal opinion is that this is not a good thing to do.
Why? Well, if the results from svd
(to use your example) are returned together there's a good reason they are returned together - they belong together. Once you break it up you lose that relationship. The only win is having fewer characters to type, and that's not one of the things we optimise with programming - readability should win over that.