Skip to content

Commit 6f3e4f1

Browse files
committed
update docs for dlimit param of categorical dists (#144)
1 parent 27a50c8 commit 6f3e4f1

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

Diff for: DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: dodgr
22
Title: Distances on Directed Graphs
3-
Version: 0.2.15.063
3+
Version: 0.2.15.064
44
Authors@R: c(
55
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
66
person("Andreas", "Petutschnig", role = "aut"),

Diff for: R/dists-categorical.R

+19-9
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99
#' distances and for each edge category; if `TRUE`, return single vector of
1010
#' proportional distances, like the `summary` function applied to full
1111
#' results. See Note.
12-
#' @param dlimit If `TRUE`, and no value to `to` is given, distances are
13-
#' aggregated from each `from` point out to the specified distance limit (in
14-
#' the same units as the edge distances of the input graph). The
15-
#' `proportions_only` argument has no effect when `dlimit = TRUE`.
16-
#' @return If `dlimit = FALSE`, a list of distance matrices of equal dimensions
12+
#' @param dlimit If no value to `to` is given, distances are aggregated from
13+
#' each `from` point out to the specified distance limit (in the same units as
14+
#' the edge distances of the input graph). `dlimit` only has any effect if `to`
15+
#' is not specified, in which case the `proportions_only` argument has no
16+
#' effect.
17+
#' @return If `to` is specified, a list of distance matrices of equal dimensions
1718
#' (length(from), length(to)), the first of which ("distance") holds the final
1819
#' distances, while the rest are one matrix for each unique value of
1920
#' "edge_type", holding the distances traversed along those types of edges only.
20-
#' If `dlimit = TRUE`, a single matrix of total distances along all ways from
21-
#' each point, along with distances along each of the different kinds of ways
22-
#' specified in the "edge_type" column of the input graph.
21+
#' Otherwise, a single matrix of total distances along all ways from each point
22+
#' out to the specified value of `dlimit`, along with distances along each of
23+
#' the different kinds of ways specified in the "edge_type" column of the input
24+
#' graph.
2325
#'
2426
#' @note The "edge_type" column in the graph can contain any kind of discrete or
2527
#' categorical values, although integer values of 0 are not permissible. `NA`
@@ -79,6 +81,14 @@ dodgr_dists_categorical <- function (graph,
7981
if (is.integer (graph$edge_type) && any (graph$edge_type == 0L)) {
8082
stop ("graphs with integer edge_type columns may not contain 0s")
8183
}
84+
if (is.null (to)) {
85+
if (is.null (dlimit)) {
86+
stop ("'dlimit' must be specified if no 'to' points are given.")
87+
}
88+
if (!(is.numeric (dlimit) && length (dlimit) == 1L)) {
89+
stop ("'dlimit' must be a single number.")
90+
}
91+
}
8292

8393
graph <- tbl_to_df (graph)
8494

@@ -121,7 +131,7 @@ dodgr_dists_categorical <- function (graph,
121131
message ("Calculating shortest paths ... ", appendLF = FALSE)
122132
}
123133

124-
if (is.null (dlimit) && !is.null (to)) {
134+
if (!is.null (to)) {
125135

126136
d <- rcpp_get_sp_dists_categorical (
127137
graph,

Diff for: codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"codeRepository": "https://github.com/ATFutures/dodgr",
88
"issueTracker": "https://github.com/ATFutures/dodgr/issues",
99
"license": "https://spdx.org/licenses/GPL-3.0",
10-
"version": "0.2.15.063",
10+
"version": "0.2.15.064",
1111
"programmingLanguage": {
1212
"@type": "ComputerLanguage",
1313
"name": "R",

Diff for: man/dodgr_dists_categorical.Rd

+10-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)