diff --git a/R/otp-isochrone-batch.R b/R/otp-isochrone-batch.R index 863d8e5..b90f729 100644 --- a/R/otp-isochrone-batch.R +++ b/R/otp-isochrone-batch.R @@ -155,7 +155,7 @@ otp_process_results_iso <- function(text, fromID){ response$id <- seq(1, nrow(response)) response$fromPlace <- fromID - if (any(!sf::st_is_valid(response))) { + if (!all(sf::st_is_valid(response))) { suppressMessages(suppressWarnings(response <- sf::st_make_valid(response))) } diff --git a/R/otp-plan.R b/R/otp-plan.R index d0f4748..011cb38 100644 --- a/R/otp-plan.R +++ b/R/otp-plan.R @@ -152,7 +152,7 @@ otp_plan <- function(otpcon = NA, checkmate::assert_logical(distance_balance, len = 1, null.ok = FALSE) checkmate::assert_logical(get_elevation, len = 1, null.ok = FALSE) - if (distance_balance & (ncores > 1)) { + if (distance_balance && (ncores > 1)) { if (is.null(fromID)) { stop("Distance balancing changes the order of the output, so fromID must not be NULL") } @@ -187,13 +187,13 @@ otp_plan <- function(otpcon = NA, nrfp <- nrow(fromPlace) nrtp <- nrow(toPlace) if (nrfp != nrtp) { - if (nrfp > nrtp & nrtp == 1) { + if (nrfp > nrtp && nrtp == 1) { toPlace <- toPlace[rep(1, times = nrfp), ] if (!is.null(toID)) { toID <- toID[rep(1, times = nrfp)] } message("repeating toPlace to match length of fromPlace") - } else if (nrtp > nrfp & nrfp == 1) { + } else if (nrtp > nrfp && nrfp == 1) { fromPlace <- fromPlace[rep(1, times = nrtp), ] if (!is.null(fromID)) { fromID <- fromID[rep(1, times = nrtp)] @@ -204,7 +204,7 @@ otp_plan <- function(otpcon = NA, } } - if (distance_balance & (ncores > 1)) { + if (distance_balance && (ncores > 1)) { dists <- geodist::geodist(fromPlace, toPlace, paired = TRUE) # Remove 0m pairs as OTP will fail on them anyway @@ -243,7 +243,7 @@ otp_plan <- function(otpcon = NA, if (otpcon$otp_version >= 2) { # maxWalkDistance causes itinaries to fail - if (mode == "CAR" | grepl("TRANSIT", mode)) { + if (mode == "CAR" || grepl("TRANSIT", mode)) { query$maxWalkDistance <- NULL } } diff --git a/R/otp-setup.R b/R/otp-setup.R index cbd758f..92e4ee4 100644 --- a/R/otp-setup.R +++ b/R/otp-setup.R @@ -402,7 +402,7 @@ otp_stop <- function(warn = TRUE, kill_all = TRUE) { ) } - if (checkmate::testOS("linux") | checkmate::testOS("mac")) { + if (checkmate::testOS("linux") || checkmate::testOS("mac")) { message("The following Java instances have been found:") system("ps -A |grep java") if (!kill_all) { @@ -456,7 +456,7 @@ otp_checks <- function(otp = NULL, chkG <- file.exists(paste0(dir, "/graphs/", router, "/Graph.obj")) chkg <- file.exists(paste0(dir, "/graphs/", router, "/graph.obj")) - if(!(chkG | chkg)){ + if(!(chkG || chkg)){ stop("File does not exist") } @@ -525,7 +525,7 @@ otp_check_java <- function(otp_version = 1.5) { } if (otp_version < 2) { - if (java_version >= 1.8 & java_version < 1.9) { + if (java_version >= 1.8 && java_version < 1.9) { message("You have the correct version of Java for OTP 1.x") return(TRUE) } @@ -544,8 +544,8 @@ otp_check_java <- function(otp_version = 1.5) { return(FALSE) } - if (otp_version >= 2 & otp_version <= 2.1) { - if (java_version >= 1.8 & java_version < 1.9) { + if (otp_version >= 2 && otp_version <= 2.1) { + if (java_version >= 1.8 && java_version < 1.9) { warning("You have OTP 2.0 or 2.1 but the version of Java for OTP 1.x") return(FALSE) } @@ -565,7 +565,7 @@ otp_check_java <- function(otp_version = 1.5) { } if (otp_version >= 2.2) { - if (java_version >= 1.8 & java_version < 1.9) { + if (java_version >= 1.8 && java_version < 1.9) { warning("You have OTP 2.2+ but the version of Java for OTP 1.x") return(FALSE) } diff --git a/R/utility-functions.R b/R/utility-functions.R index 6a5d769..b5c2457 100644 --- a/R/utility-functions.R +++ b/R/utility-functions.R @@ -61,7 +61,7 @@ parse_leg <- function(leg, leg$from <- NULL leg$to <- NULL - if (get_elevation | full_elevation) { + if (get_elevation || full_elevation) { elevation <- purrr::map(leg$steps, parse_elevation) } else { elevation <- list(NULL)