Skip to content

Instantly share code, notes, and snippets.

View JosiahParry's full-sized avatar
💻
on the 'puter

Josiah Parry JosiahParry

💻
on the 'puter
View GitHub Profile
@JosiahParry
JosiahParry / read-swm.R
Last active December 31, 2024 17:00
Read an ArcGIS SWM File as spdep listw
# Original function
read_swm <- function(file) {
con <- file(file, "rb")
header <- NULL
while(TRUE) {
r <- readBin(con, "raw", size=1L, n=1, endian="little")
if (r == charToRaw("\n")) break
else header <- c(header, r)
}
cheader <- rawToChar(header)