srowen commented on a change in pull request #28419:
URL: https://github.com/apache/spark/pull/28419#discussion_r418003276



##########
File path: dev/lint-r.R
##########
@@ -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/[email protected]")
+# Installs lintr if needed
+if (!requireNamespace("lintr")) {
+  install.packages('lintr')

Review comment:
       Looks like there was sort of a reason for installing a particular 
version: https://github.com/apache/spark/pull/26564#discussion_r347198119 But 
the logic seems to be "use the new 2.0.0 version". This would always pick up 
the latest. I'm guessing that's OK, @dongjoon-hyun ?

##########
File path: R/create-rd.sh
##########
@@ -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") }'

Review comment:
       It seems fine but I don't know these commands; any potential behavior 
change here?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to