Skip to content

Commit

Permalink
fix vector dist check for #26
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jul 2, 2020
1 parent 57a9507 commit 401e296
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: geodist
Title: Fast, Dependency-Free Geodesic Distance Calculations
Version: 0.0.4.009
Version: 0.0.4.010
Authors@R:
c(person(given = "Mark",
family = "Padgham",
Expand Down
8 changes: 2 additions & 6 deletions R/geodist-vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,8 @@ geodist_vec <- function (x1, y1, x2, y2, paired = FALSE,
res <- geodist_x_vec (x1, y1, measure)
}

if (measure == "cheap") {
if (max (d) > 100000)
message ("Maximum distance is > 100km. The 'cheap' measure is ",
"inaccurate over such\nlarge distances, you'd likely ",
"be better using a different 'measure'.")
}
if (measure == "cheap")
check_max_d (res, measure)

return (res)
}
Expand Down
3 changes: 2 additions & 1 deletion R/geodist.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ geodist <- function (x, y, paired = FALSE,
res <- geodist_x (x, measure)
}

check_max_d (res, measure)
if (measure == "cheap")
check_max_d (res, measure)

return (res)
}
Expand Down
10 changes: 4 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ convert_to_matrix <- function (obj)
}

check_max_d <- function (d, measure) {
if (measure == "cheap") {
if (max (d) > 100000)
message ("Maximum distance is > 100km. The 'cheap' measure is ",
"inaccurate over such\nlarge distances, you'd likely ",
"be better using a different 'measure'.")
}
if (max (d, na.rm = TRUE) > 100000)
message ("Maximum distance is > 100km. The 'cheap' measure is ",
"inaccurate over such\nlarge distances, you'd likely ",
"be better using a different 'measure'.")
}
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"codeRepository": "https://github.com/hypertidy/geodist",
"issueTracker": "https://github.com/hypertidy/geodist/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.0.4.9",
"version": "0.0.4.010",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 401e296

Please sign in to comment.