diff options
author | felixcheung <felixcheung_m@hotmail.com> | 2015-11-18 23:32:49 -0800 |
---|---|---|
committer | Shivaram Venkataraman <shivaram@cs.berkeley.edu> | 2015-11-18 23:32:49 -0800 |
commit | 1a93323c5bab18ed7e55bf6f7b13aae88cb9721c (patch) | |
tree | e1c867c4d8e04248bf3aa89f3263a85ad87ef9f3 /docs | |
parent | d02d5b9295b169c3ebb0967453b2835edb8a121f (diff) | |
download | spark-1a93323c5bab18ed7e55bf6f7b13aae88cb9721c.tar.gz spark-1a93323c5bab18ed7e55bf6f7b13aae88cb9721c.tar.bz2 spark-1a93323c5bab18ed7e55bf6f7b13aae88cb9721c.zip |
[SPARK-11339][SPARKR] Document the list of functions in R base package that are masked by functions with same name in SparkR
Added tests for function that are reported as masked, to make sure the base:: or stats:: function can be called.
For those we can't call, added them to SparkR programming guide.
It would seem to me `table, sample, subset, filter, cov` not working are not actually expected - I investigated/experimented with them but couldn't get them to work. It looks like as they are defined in base or stats they are missing the S3 generic, eg.
```
> methods("transform")
[1] transform,ANY-method transform.data.frame
[3] transform,DataFrame-method transform.default
see '?methods' for accessing help and source code
> methods("subset")
[1] subset.data.frame subset,DataFrame-method subset.default
[4] subset.matrix
see '?methods' for accessing help and source code
Warning message:
In .S3methods(generic.function, class, parent.frame()) :
function 'subset' appears not to be S3 generic; found functions that look like S3 methods
```
Any idea?
More information on masking:
http://www.ats.ucla.edu/stat/r/faq/referencing_objects.htm
http://www.sfu.ca/~sweldon/howTo/guide4.pdf
This is what the output doc looks like (minus css):
![image](https://cloud.githubusercontent.com/assets/8969467/11229714/2946e5de-8d4d-11e5-94b0-dda9696b6fdd.png)
Author: felixcheung <felixcheung_m@hotmail.com>
Closes #9785 from felixcheung/rmasked.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/sparkr.md | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/docs/sparkr.md b/docs/sparkr.md index a744b76be7..cfb9b41350 100644 --- a/docs/sparkr.md +++ b/docs/sparkr.md @@ -286,7 +286,7 @@ head(teenagers) # Machine Learning -SparkR allows the fitting of generalized linear models over DataFrames using the [glm()](api/R/glm.html) function. Under the hood, SparkR uses MLlib to train a model of the specified family. Currently the gaussian and binomial families are supported. We support a subset of the available R formula operators for model fitting, including '~', '.', ':', '+', and '-'. +SparkR allows the fitting of generalized linear models over DataFrames using the [glm()](api/R/glm.html) function. Under the hood, SparkR uses MLlib to train a model of the specified family. Currently the gaussian and binomial families are supported. We support a subset of the available R formula operators for model fitting, including '~', '.', ':', '+', and '-'. The [summary()](api/R/summary.html) function gives the summary of a model produced by [glm()](api/R/glm.html). @@ -351,3 +351,38 @@ summary(model) ##Sepal_Width 0.404655 {% endhighlight %} </div> + +# R Function Name Conflicts + +When loading and attaching a new package in R, it is possible to have a name [conflict](https://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html), where a +function is masking another function. + +The following functions are masked by the SparkR package: + +<table class="table"> + <tr><th>Masked function</th><th>How to Access</th></tr> + <tr> + <td><code>cov</code> in <code>package:stats</code></td> + <td><code><pre>stats::cov(x, y = NULL, use = "everything", + method = c("pearson", "kendall", "spearman"))</pre></code></td> + </tr> + <tr> + <td><code>filter</code> in <code>package:stats</code></td> + <td><code><pre>stats::filter(x, filter, method = c("convolution", "recursive"), + sides = 2, circular = FALSE, init)</pre></code></td> + </tr> + <tr> + <td><code>sample</code> in <code>package:base</code></td> + <td><code>base::sample(x, size, replace = FALSE, prob = NULL)</code></td> + </tr> + <tr> + <td><code>table</code> in <code>package:base</code></td> + <td><code><pre>base::table(..., + exclude = if (useNA == "no") c(NA, NaN), + useNA = c("no", "ifany", "always"), + dnn = list.names(...), deparse.level = 1)</pre></code></td> + </tr> +</table> + +You can inspect the search path in R with [`search()`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/search.html) + |