For a Ruby project I need an OpenCPU server to process some statistics by R packages. OpenCPU has an JSON REST API, so with Ruby I can easily hook into that to communicate with R. So far, so good.
One of those packages has a strange (at least to me) syntax.
add <- function(.argument1, .argument2) {
return(.argument1 + .argument2)
}
So this is just an example, not the actual function. The part I found weird are those points in front of parameters. When I suggested to remove those points, the developer of the package said that it was meant to hide the variables from the overview of variables in IDE (R-Studio). It sounds to me like he wanted to make the parameters, what we call it, private, or at least to scope it somehow. I searched the internets to explain this feature of R, but found nothing.
The actual problem is: we use Ruby, Ruby translates data into JSON and sends it to OpenCPU. OpenCPU looks up for the right package/function, passes arguments and executes it. Then it returns to OpenCPU which makes a JSON response. Ruby's >1.9 Hash syntax that we prefer to work with looks like:
{ argument1: 4, argument2: 3 }.to_json
# => { "argument1": 4, "argument2": 3 }
instead of older forced by the package arguments:
{ ".argument1" => 4, ".argument2" => 3 }.to_json
# => { ".argument1": 4, ".argument2": 3 }
So in desperate search for an argument to convince the R-developer not to use the dots, my question was still unanswered: does this point in front of the parameters have a real functionality in R or is it just a hack to exclude the variables from the IDE?