Commit 71b6904b authored by Facundo Muñoz's avatar Facundo Muñoz ®️
Browse files

read_network(): bugfix in error message when checking the number of columns.

parent 5b5d1d1b
Package: mapMCDA
Title: Produce an epidemiological risk map by weighting multiple risk
factors
Version: 0.4.43
Date: 2020-04-24
Version: 0.4.45
Date: 2020-04-25
Authors@R: c( person("Andrea", "Apolloni", email =
"andrea.apolloni@cirad.fr", role = c("ctb"), comment = "Animal
mobility algorithm"), person("Elena", "Arsevska", email =
......
......@@ -74,7 +74,7 @@ must be respected:",
## Check number of columns
if (nc < 6 | nc > 7) {
stop("Expected 6 or 7 columns, observed ", ncol(dat),
stop("Expected 6 or 7 columns, observed ", nc,
message(paste(input_format, collapse = "\n")))
}
......
......@@ -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"
)
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment