 # Calling a Function - Learning R Hello,

It might be a super dumb question but I don’t understand how you get an output of 30 in the sum function? Which numbers are you adding up? I was trying to add the total of the sort function + length function which equaled to 27.

Hello! The `sum()` function adds up its parameters. That means it will add `5`, `15` and `10`:

``````sum(x, y, z)
//does the same calculation as:
x + y + z
``````

I hope this helps!

I am still confused I am getting confused at what they meant by this:

• On the third line, we called a function `sum()` which added up all of the arguments we passed to it.

When it says arguments, it means the numbers that are between the parentheses`()`. So, since it passed in `5, 15, 10`, you get `5+15+10=30`:

``````sum(5, 10, 15)
^^^^^^^
all of these are parameters
``````

And the job of the `sum` function is to add all of its parameters together.

Isn't it one parameter-a vector?

No, since you are only passing values into the function (no variables), you need to use `c()` to create a vector. Yet since the values `5,15,10` are on their own (there is no `c()`:

``````c(5, 15, 10)#this is a vector of three values
5, 15, 10#these are just three values
``````

Each value is a separate argument.

I hope this helps!

1 Like