[MINOR][R] small tidying of sh scripts for R
### What changes were proposed in this pull request? Some tidying of `sh` scripts in `R/` ### Why are the changes needed? Not strictly needed, but the `'devtools' %in% installed.packages()` line in particular is "improper" / proabbly slow ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Not Closes #28419 from MichaelChirico/r-scripts-cleanup. Authored-by: Michael Chirico <michael.chirico@grabtaxi.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This commit is contained in:
parent
2410a45703
commit
c00fe5ef3e
|
@ -49,7 +49,7 @@ pushd "$FWDIR" > /dev/null
|
|||
mkdir -p pkg/html
|
||||
pushd pkg/html
|
||||
|
||||
"$R_SCRIPT_PATH/Rscript" -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); library(knitr); knit_rd("SparkR", links = tools::findHTMLlinks(paste(libDir, "SparkR", sep="/")))'
|
||||
"$R_SCRIPT_PATH/Rscript" -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); knitr::knit_rd("SparkR", links = tools::findHTMLlinks(file.path(libDir, "SparkR")))'
|
||||
|
||||
popd
|
||||
|
||||
|
|
|
@ -34,4 +34,4 @@ pushd "$FWDIR" > /dev/null
|
|||
. "$FWDIR/find-r.sh"
|
||||
|
||||
# Generate Rd files if devtools is installed
|
||||
"$R_SCRIPT_PATH/Rscript" -e ' if("devtools" %in% rownames(installed.packages())) { library(devtools); setwd("'$FWDIR'"); devtools::document(pkg="./pkg", roclets=c("rd")) }'
|
||||
"$R_SCRIPT_PATH/Rscript" -e ' if(requireNamespace("devtools", quietly=TRUE)) { setwd("'$FWDIR'"); devtools::document(pkg="./pkg", roclets="rd") }'
|
||||
|
|
|
@ -20,14 +20,13 @@ SPARK_ROOT_DIR <- as.character(argv[1])
|
|||
LOCAL_LIB_LOC <- file.path(SPARK_ROOT_DIR, "R", "lib")
|
||||
|
||||
# Checks if SparkR is installed in a local directory.
|
||||
if (! library(SparkR, lib.loc = LOCAL_LIB_LOC, logical.return = TRUE)) {
|
||||
if (!requireNamespace("SparkR", lib.loc = LOCAL_LIB_LOC)) {
|
||||
stop("You should install SparkR in a local directory with `R/install-dev.sh`.")
|
||||
}
|
||||
|
||||
# Installs lintr from Github in a local directory.
|
||||
# NOTE: The CRAN's version is too old to adapt to our rules.
|
||||
if ("lintr" %in% row.names(installed.packages()) == FALSE) {
|
||||
devtools::install_github("jimhester/lintr@v2.0.0")
|
||||
# Installs lintr if needed
|
||||
if (!requireNamespace("lintr")) {
|
||||
install.packages('lintr')
|
||||
}
|
||||
|
||||
library(lintr)
|
||||
|
|
Loading…
Reference in a new issue