For example I have 2 variables a and b (actually more than 2 in my real case), can I assign values for them in a way like c(a,b)<-c(0,0), just like the Tuple in Python? Thank you.
For example I have 2 variables a and b (actually more than 2 in
Share
There’s no built in way to do it – what you’re looking for is very similar to
listsandvectorsinR– instead of calling backa,b, andc, you call backa[1],a[2], anda[3]. If it’s important for you to be able to call back this values by separate names, and to be able to assign them from the same line, you can make a simple function:I couldn’t figure out a way for the
applyfamily to tackle this one without making it too complicated – maybe someone could help me out.