You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/README.md
+14-16Lines changed: 14 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,7 @@ SparkR is an R package that provides a light-weight frontend to use Spark from R
7
7
Libraries of sparkR need to be created in `$SPARK_HOME/R/lib`. This can be done by running the script `$SPARK_HOME/R/install-dev.sh`.
8
8
By default the above script uses the system wide installation of R. However, this can be changed to any user installed location of R by setting the environment variable `R_HOME` the full path of the base directory where R is installed, before running install-dev.sh script.
9
9
Example:
10
-
11
-
```
10
+
```bash
12
11
# where /home/username/R is where R is installed and /home/username/R/bin contains the files R and RScript
13
12
export R_HOME=/home/username/R
14
13
./install-dev.sh
@@ -20,8 +19,8 @@ export R_HOME=/home/username/R
20
19
21
20
Build Spark with [Maven](http://spark.apache.org/docs/latest/building-spark.html#building-with-buildmvn) and include the `-Psparkr` profile to build the R package. For example to use the default Hadoop versions you can run
22
21
23
-
```
24
-
build/mvn -DskipTests -Psparkr package
22
+
```bash
23
+
build/mvn -DskipTests -Psparkr package
25
24
```
26
25
27
26
#### Running sparkR
@@ -40,9 +39,8 @@ To set other options like driver memory, executor memory etc. you can pass in th
40
39
41
40
#### Using SparkR from RStudio
42
41
43
-
If you wish to use SparkR from RStudio or other R frontends you will need to set some environment variables which point SparkR to your Spark installation. For example
44
-
45
-
```
42
+
If you wish to use SparkR from RStudio or other R frontends you will need to set some environment variables which point SparkR to your Spark installation. For example
43
+
```R
46
44
# Set this to where Spark is installed
47
45
Sys.setenv(SPARK_HOME="/Users/username/spark")
48
46
# This line loads SparkR from the installed directory
@@ -59,25 +57,25 @@ Once you have made your changes, please include unit tests for them and run exis
59
57
60
58
#### Generating documentation
61
59
62
-
The SparkR documentation (Rd files and HTML files) are not a part of the source repository. To generate them you can run the script `R/create-docs.sh`. This script uses `devtools` and `knitr` to generate the docs and these packages need to be installed on the machine before using the script.
60
+
The SparkR documentation (Rd files and HTML files) are not a part of the source repository. To generate them you can run the script `R/create-docs.sh`. This script uses `devtools` and `knitr` to generate the docs and these packages need to be installed on the machine before using the script. Also, you may need to install these [prerequisites](https://github.com/apache/spark/tree/master/docs#prerequisites). See also, `R/DOCUMENTATION.md`
63
61
64
62
### Examples, Unit tests
65
63
66
64
SparkR comes with several sample programs in the `examples/src/main/r` directory.
67
65
To run one of them, use `./bin/spark-submit <filename> <args>`. For example:
You can also run the unit tests for SparkR by running. You need to install the [testthat](http://cran.r-project.org/web/packages/testthat/index.html) package first:
72
-
73
-
R -e 'install.packages("testthat", repos="http://cran.us.r-project.org")'
74
-
./R/run-tests.sh
70
+
```bash
71
+
R -e 'install.packages("testthat", repos="http://cran.us.r-project.org")'
72
+
./R/run-tests.sh
73
+
```
75
74
76
75
### Running on YARN
77
76
78
77
The `./bin/spark-submit` can also be used to submit jobs to YARN clusters. You will need to set YARN conf dir before doing so. For example on CDH you can run
0 commit comments