Quantcast
Viewing latest article 9
Browse Latest Browse All 9

R: Swap two variables without using a third

I have two variables (i.e.):

   a <- 1   b <- 2

and I would like to swap their values. Is there any built-in R function, that is able to perform that operation? Or is there an other elegant way, without using a third (temp) variable?

Note: If possible applicable on strings, or other datatypes.


Viewing latest article 9
Browse Latest Browse All 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>