ii <- integer()
for (i in seq_len(nrow(wrld_simpl))) {
if (!rgeos::gIsValid(wrld_simpl[i, ])) ii <- c(ii, i)
}
print(ii)
plot(wrld_simpl[ii, ])
There are r length(ii) features that present the same kind of message. We can't really use these messages as they are so let's start extracting the information.
parse_self_intersection <- function(x) {
as.numeric(unlist(strsplit(gsub("Ring Self-intersection at or near point) ", "", x), " ")))
}
for (i in seq_len(nrow(wrld_simpl))) {
withCallingHandlers(rgeos::gIsValid(wrld_simpl[24, ]), warning = function(w) parse_self_intersection(w))
}
title: "Vignette Title" author: "Vignette Author" date: "
r Sys.Date()
" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Fixing problems in spatial data} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8}Problems in spatial data are fairly common.
What does that mean?
There are
r length(ii)
features that present the same kind of message. We can't really use these messages as they are so let's start extracting the information.