Skip to content

Commit 09f4292

Browse files
committed
✨ Add get_unlikely_observation()
1 parent ff9dbcc commit 09f4292

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export(distance_matrix)
66
export(edge_distribution)
77
export(get_cluster)
88
export(get_total)
9+
export(get_unlikely_observation)
910
export(get_unlikely_summary)
1011
export(import_observations)
1112
export(simulate_observations)

R/get_unlikely.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,19 @@ INNER JOIN unlikely AS u ON c.survey = u.survey
2020
ORDER BY c.region, c.survey" |>
2121
dbGetQuery(conn = conn)
2222
}
23+
24+
#' Get the unlikely observations
25+
#' @inheritParams import_observations
26+
#' @export
27+
#' @importFrom assertthat assert_that
28+
#' @importFrom RSQLite dbGetQuery
29+
#' @importFrom sf st_as_sf
30+
get_unlikely_observation <- function(conn, crs = 31370) {
31+
assert_that(inherits(conn, "SQLiteConnection"))
32+
"SELECT o.id, o.x, o.y, o.status, o.region, o.survey, s.original, s.user
33+
FROM observation AS o
34+
INNER JOIN unlikely AS u ON o.survey = u.survey
35+
INNER JOIN survey AS s on o.survey = s.id" |>
36+
dbGetQuery(conn = conn) |>
37+
st_as_sf(coords = c("x", "y"), crs = crs)
38+
}

man/get_unlikely_observation.Rd

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)