Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

In R, how can loop multiple variable at the same?

$
0
0

I am wondering of how can I loop the multiple variables at the same time in R.

For example,

a = c(1, 2, 3)
b = c(4, 5, 6)

And then for loop, the below code didnt work.

for (i, j in a, b) {
    print(i)
    print(j)
}

In Python,

for i,j in zip(a,b):
  print(i)
  print(j)

it is possible. How can I do this in R?


Viewing all articles
Browse latest Browse all 201867

Trending Articles



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