I need to write the equivalent of the following code in R but I'm not quite sure how to go about it:

```
def add(args):
  result = args["a"] + args["b"]
  return result

```

The reason why is because for the platform I am using (Cloudera Data Science Workbench) models need a JSON input to be able to call them using an API key

So if I write a test model in R such as:

```
f <- function(x, y) {
    return (x + y)
}

```

I cannot do a call like {"x" : 2, "y" : 4} using the `httr` package.

So I either need to make a dictionary like call for functions in R

OR

I am simply calling JSON incorrectly in which case could someone help me format that correctly for an API call

Thanks