Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UMR-ASTRE
mapMCDA
Commits
71b6904b
Commit
71b6904b
authored
Apr 25, 2020
by
Facundo Muñoz
®️
Browse files
read_network(): bugfix in error message when checking the number of columns.
parent
5b5d1d1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
71b6904b
Package: mapMCDA
Title: Produce an epidemiological risk map by weighting multiple risk
factors
Version: 0.4.4
3
Date: 2020-04-2
4
Version: 0.4.4
5
Date: 2020-04-2
5
Authors@R: c( person("Andrea", "Apolloni", email =
"andrea.apolloni@cirad.fr", role = c("ctb"), comment = "Animal
mobility algorithm"), person("Elena", "Arsevska", email =
...
...
R/network.R
View file @
71b6904b
...
...
@@ -74,7 +74,7 @@ must be respected:",
## Check number of columns
if
(
nc
<
6
|
nc
>
7
)
{
stop
(
"Expected 6 or 7 columns, observed "
,
nc
ol
(
dat
)
,
stop
(
"Expected 6 or 7 columns, observed "
,
nc
,
message
(
paste
(
input_format
,
collapse
=
"\n"
)))
}
...
...
tests/testthat/test-load.R
View file @
71b6904b
...
...
@@ -7,6 +7,8 @@ test_that("layer_type() correctly identifies file extensions", {
vector
=
"b.shp"
,
raster
=
"c.tif"
,
raster
=
"d.tiff"
,
raster
=
"d.grd"
,
raster
=
"d.gri"
,
network
=
"e.csv"
,
"NA"
=
"z.zzz"
)
...
...
@@ -78,3 +80,15 @@ test_that("Interpret network data", {
close
(
file
(
tf
))
close
(
file
(
tf2
))
})
test_that
(
"Informative errors for incorrectly formatted network data"
,
{
## Incorrect number of columns
tf
<-
tempfile
(
fileext
=
".csv"
)
write.csv
(
data.frame
(
x
=
1
:
5
,
y
=
1
:
5
),
file
=
tf
,
row.names
=
FALSE
)
expect_error
(
read_network
(
tf
),
"Expected 6 or 7 columns"
)
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment