本文介绍了SparkR的安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有R的最后一个版本 - 3.2.1。现在,我想在R.安装SparkR我执行后:

I have the last version of R - 3.2.1. Now I want to install SparkR on R. After I execute:

> install.packages("SparkR")

我回来了:

Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘SparkR’ is not available (for R version 3.2.1)

我也我的机器上安装了星火

I have also installed Spark on my machine

Spark 1.4.0

我怎样才能解决这个问题(其实我用RStudio或只是从终端)

How I can solve this problem (actually I use RStudio or just from terminal)

推荐答案

您可以直接从GitHub的库安装:

You can install directly from a GitHub repository:

if (!require('devtools')) install.packages('devtools')
devtools::install_github('apache/[email protected]', subdir='R/pkg')

您应该选择标记( V1.4.0 以上)与您使用Spark版本。您可以使用在或直接与R标记的:

You should choose tag (v1.4.0 above) corresponding to the version of Spark you use. You can find a full list of tags on the project page or directly from R using GitHub API:

jsonlite::fromJSON("https://api.github.com/repos/apache/spark/tags")$name

如果您已经从一个下载页面ř库是在研究/ lib目录/ SparkR 子目录。它可用于直接安装SparkR。例如:

If you've downloaded binary package from a downloads page R library is in a R/lib/SparkR subdirectory. It can be used to install SparkR directly. For example:

$ export SPARK_HOME=/path/to/spark/directory
$ cd $SPARK_HOME/R/lib/SparkR/
$ R -e "devtools::install('.')"

您也可以加上R的lib到 .libPaths (从的):

You can also add R lib to .libPaths (taken from here):

Sys.setenv(SPARK_HOME='/path/to/spark/directory')
.libPaths(c(file.path(Sys.getenv('SPARK_HOME'), 'R', 'lib'), .libPaths()))

无需任何额外的步骤

最后,你可以使用 sparkR 外壳:

Finally, you can use sparkR shell without any additional steps:

$ /path/to/spark/directory/bin/sparkR

这篇关于SparkR的安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 08:40