string <- "\"sidewalk\"=>\"none\""
print(string, quote = FALSE)
#> [1] "sidewalk"=>"none"
read.table(
text = gsub(',?([^,]+)=>',"\n\\1:", string, perl = TRUE),
sep = ":",
col.names = c("key", "value")
)
#> key value
# packages
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(sfnetworks)
# create network
roxel_sfn <- as_sfnetwork(roxel, directed = FALSE)
# sample two points in that area
# packages
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(tidygraph)
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
#> filter
# load packages
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(tidygraph)
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
#> filter
# packages
library(INLA)
#> Carico il pacchetto richiesto: Matrix
#> Carico il pacchetto richiesto: foreach
#> Carico il pacchetto richiesto: parallel
#> Carico il pacchetto richiesto: sp
#> This is INLA_21.02.23 built 2021-02-22 21:11:05 UTC.
#> - See www.r-inla.org/contact-us for how to get help.
# packages
library(spdep)
#> Loading required package: sp
#> Loading required package: spData
#> Loading required package: sf
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(rgdal)
#> rgdal: version: 1.5-12, (SVN revision 1018)
#> Geospatial Data Abstraction Library extensions to R successfully loaded
# packages
library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(sfnetworks)
library(tidygraph)
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
# packages
library(INLA)
#> Loading required package: Matrix
#> Loading required package: sp
#> Loading required package: parallel
#> Loading required package: foreach
#> This is INLA_20.03.09 built 2020-03-09 09:12:35 UTC.
#> See www.r-inla.org/contact-us for how to get help.
inla.version()
# packages
library(INLA)
#> Loading required package: Matrix
#> Loading required package: sp
#> Loading required package: parallel
#> Loading required package: foreach
#> This is INLA_20.03.09 built 2020-03-09 09:12:35 UTC.
#> See www.r-inla.org/contact-us for how to get help.
# packages
library(countreg) # for CDF of Hurdle Poisson distribution
#> Loading required package: MASS
# Take nonrandomized PIT function from Czado et al. (2009)
czado_pit <- function(x, Px, Px1, n.bins=10, y.max=2.75, my.title="PIT Histogram")
{
a.mat <- matrix(0,n.bins,length(x))
k.vec <- pmax(ceiling(n.bins*Px1),1)