If you want to start learning the R programming or you have a bit knowledge about R programming, then this tutorial will help you to explore more. In this tutorial, we are going to share a **R program to add two vectors** with an example.

Copy the below code and execute it to see the program output.

R

1 2 3 4 5 6 7 8 9 10 11 12 13 |
> x [1] 3 6 8 > y [1] 2 9 0 > x + y [1] 5 15 8 > x + 1 # 1 is recycled to (1,1,1) [1] 4 7 9 > x + c(1,4) # (1,4) is recycled to (1,4,1) but warning issued [1] 4 10 9 Warning message: In x + c(1, 4) : longer object length is not a multiple of shorter object length |

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

- r program for factorial using recursion
- R program to find L.C.M. with the output
- R program to take input from user with the output
- Convert decimal into binary using recursion in R
- Odd or Even program in R programming
- R program to check armstrong number
- R program to find the sum of natural numbers
- r practice problems for beginners
- R Program to Check for Leap Year with the output
- How to Find L.C.M in R Programming with example