tangled
alpha
login
or
join now
mpadge.tngl.sh
/
dodgr
0
fork
atom
Distances on Directed Graphs in R
0
fork
atom
overview
issues
pulls
pipelines
expand tests for #299
mpadge.tngl.sh
8 months ago
655ed960
dca7bd45
+39
-4
4 changed files
expand all
collapse all
unified
split
DESCRIPTION
R
weight-streetnet-times.R
codemeta.json
tests
testthat
test-streetnet.R
+1
-1
DESCRIPTION
···
1
1
Package: dodgr
2
2
Title: Distances on Directed Graphs
3
3
-
Version: 0.4.2.050
3
3
+
Version: 0.4.2.051
4
4
Authors@R: c(
5
5
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")),
6
6
person("Andreas", "Petutschnig", role = "aut"),
+10
-2
R/weight-streetnet-times.R
···
119
119
120
120
oneway_keys <- tolower (substring (names (table (graph$oneway)), 1, 1))
121
121
if (length (oneway_keys) > 2L) {
122
122
-
warning ("'oneway' column has ambiguous values; should be TRUE/FALSE or 'yes'/'no' only")
122
122
+
warning (
123
123
+
"'oneway' column has ambiguous values; ",
124
124
+
"should be TRUE/FALSE or 'yes'/'no' only",
125
125
+
call. = FALSE
126
126
+
)
127
127
+
oneway_keys <- oneway_keys [which (oneway_keys %in% c ("0", "1", "y", "n", "t", "f"))]
123
128
}
124
129
if (all (oneway_keys %in% c ("0", "1"))) {
125
130
graph$oneway <- as.logical (graph$oneway)
126
131
} else if (all (oneway_keys %in% c ("y", "n"))) {
127
132
graph$oneway <- tolower (substring (graph$oneway, 1, 1))
128
128
-
graph$oneway <- ifelse (graph$oneway == "no", FALSE, TRUE)
133
133
+
graph$oneway <- ifelse (graph$oneway == "y", TRUE, FALSE)
134
134
+
} else if (all (oneway_keys %in% c ("t", "f"))) {
135
135
+
graph$oneway <- tolower (substring (graph$oneway, 1, 1))
136
136
+
graph$oneway <- ifelse (graph$oneway == "t", TRUE, FALSE)
129
137
}
130
138
131
139
if (length (bikeflags) == 1) {
+1
-1
codemeta.json
···
11
11
"codeRepository": "https://github.com/UrbanAnalyst/dodgr",
12
12
"issueTracker": "https://github.com/UrbanAnalyst/dodgr/issues",
13
13
"license": "https://spdx.org/licenses/GPL-3.0",
14
14
-
"version": "0.4.2.050",
14
14
+
"version": "0.4.2.051",
15
15
"programmingLanguage": {
16
16
"@type": "ComputerLanguage",
17
17
"name": "R",
+27
tests/testthat/test-streetnet.R
···
164
164
h$oneway [index] <- "yes"
165
165
graph4 <- weight_streetnet (h, wt_profile = "bicycle")
166
166
expect_identical (nrow (graph2), nrow (graph4))
167
167
+
168
168
+
# Different encodings for oneway columns
169
169
+
h <- hampi
170
170
+
h$oneway [1] <- "no"
171
171
+
h$oneway [2] <- "maybe"
172
172
+
expect_warning (
173
173
+
graph5 <- weight_streetnet (h, wt_profile = "bicycle"),
174
174
+
"'oneway' column has ambiguous values"
175
175
+
)
176
176
+
expect_equal (nrow (graph5), nrow (graph0))
177
177
+
178
178
+
h$oneway [2] <- NA_character_
179
179
+
h$oneway [h$oneway == "no"] <- "false"
180
180
+
h$oneway [h$oneway == "yes"] <- "true"
181
181
+
graph6 <- weight_streetnet (h, wt_profile = "bicycle")
182
182
+
expect_equal (nrow (graph5), nrow (graph6))
183
183
+
184
184
+
h$oneway [h$oneway == "false"] <- 0
185
185
+
h$oneway [h$oneway == "true"] <- 1
186
186
+
storage.mode (h$oneway) <- "numeric"
187
187
+
graph7 <- weight_streetnet (h, wt_profile = "bicycle")
188
188
+
expect_equal (nrow (graph5), nrow (graph7))
189
189
+
190
190
+
h$oneway <- as.logical (h$oneway)
191
191
+
h$oneway [2] <- h$oneway [3] <- TRUE
192
192
+
graph8 <- weight_streetnet (h, wt_profile = "bicycle")
193
193
+
expect_lt (nrow (graph8), nrow (graph7))
167
194
})
168
195
169
196
test_that ("wt_profile", {