0

Say I have a vector. I need to select every two elements. I need to do this in a loop and pass it on to different vector

for eg A<-c(1:10) i want to select elements like (1,2) (3,4),(5,6) and so on and pass the sum of these two elements into another vector. required output is (3,7,11,15)

2
  • I added more relevant links, see if they are helpful. Commented May 6, 2019 at 9:51
  • The example in your edit seems completely different from what you first described. Search back through previous SO posts, but if you can't find something that helps, maybe you should post a different question with a clear example of what you need to do Commented May 6, 2019 at 13:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.