Skip to content

Commit

Permalink
fix SWM write example
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbivand committed Nov 24, 2024
1 parent 00f3380 commit 4a63c02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 8 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Version 1.3-6 (development)
# Version 1.3-7.1 (development)

* add `write.swmdbf` #171 to complement #163

* modify defaults for `licd_multi`

# Version 1.3-6 (2024-09-13)


* adding vignette describing recent changes in `poly2nb` from #162, subgraph and no-neighbour (island) handling

Expand Down
11 changes: 6 additions & 5 deletions R/read.gwt2nb.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ write.sn2DBF <- function(sn, file) {
nms <- as.character(attr(sn, "region.id"))
sn[,1] <- as.integer(nms[sn[,1]])
sn[,2] <- as.integer(nms[sn[,2]])
sn <- cbind(data.frame(Field1=rep(0L, nrow(sn))), sn)
if (requireNamespace("foreign", quietly=TRUE)) {
foreign::write.dbf(sn, file)
} else warning("foreign::read.dbf not available")
invisible(sn)
names(sn)[1:2] <- c("ID", "NID")
sn <- cbind(data.frame(Field1=rep(0L, nrow(sn))), sn)
if (requireNamespace("foreign", quietly=TRUE)) {
foreign::write.dbf(sn, file)
} else warning("foreign::read.dbf not available")
invisible(sn)
}

# Copyright 2011 Virgilio Gomez-Rubio
Expand Down

0 comments on commit 4a63c02

Please sign in to comment.