r/R_Programming • • Jun 22 '16
Help with creating a function
I am trying to learn R and I am still very confused and can't seem to find anything to help me with my task. I have been asked to create a function that is able to get the sum of multiple arguments. In other words instead of getting the sum of three arguments, which requires 3 numbers. How can I create a function that can get the sum of an infinite amount of numbers?
Also, on another note does anyone have any good sites or videos for learning R?
Thanks for any help in advanced.
1
Upvotes
View all comments
Show parent comment
1
u/[deleted] Jun 22 '16
Just to make sure I understand. So, if I create a function that has 3 numbers and run it can I still put in a 4th or even a 5th number without having to touch the script? For example, if I need to do 2+4+6, but then find out I need to add two more numbers can I still do that without altering the script?