Skip to content

Commit

Permalink
little edits to make it to cran
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGelb committed Aug 22, 2023
1 parent 815de8d commit 2a53b75
Show file tree
Hide file tree
Showing 29 changed files with 80 additions and 75 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: spNetwork
Type: Package
Title: Spatial Analysis on Network
Version: 0.4.3.6.9000
Version: 0.4.3.7
Authors@R: c(
person("Jeremy", "Gelb", email = "[email protected]",role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7114-2714")),
person("Philippe", "Apparicio", email="[email protected]", role=c("ctb"), comment = c(ORCID = "0000-0001-6466-9342")))
Expand Down Expand Up @@ -46,7 +46,7 @@ Suggests:
covr (>= 3.5.1),
knitr,
rmarkdown
RoxygenNote: 7.1.2
RoxygenNote: 7.2.3
VignetteBuilder:
knitr
URL: https://jeremygelb.github.io/spNetwork/
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# spNetwork 0.4.3.7

This is only a maintenance release. A bug in CRAN caused by multiprocessing in example caused the rejection of hte package.
All the test and examples are now using only one worker.

# spNetwork 0.4.3.6.9000

## corrected bugs
Expand Down
2 changes: 1 addition & 1 deletion R/bandwidth_selection_cv_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ bw_cv_likelihood_calc <- function(bw_range,bw_step,lines, events, w, kernel_name
#' \donttest{
#' data(mtl_network)
#' data(bike_accidents)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' cv_scores <- bw_cv_likelihood_calc.mc(c(200,800),50,
#' mtl_network, bike_accidents,
#' rep(1,nrow(bike_accidents)),
Expand Down
2 changes: 1 addition & 1 deletion R/bandwidth_selection_cv_tnkde_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ bw_tnkde_cv_likelihood_calc <- function(bw_net_range, bw_net_step,
#' bike_accidents$Time <- as.numeric(bike_accidents$Time)
#' bike_accidents <- subset(bike_accidents, bike_accidents$Time>=89)
#'
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#'
#' # calculating the cross validation values
#' cv_scores <- bw_tnkde_cv_likelihood_calc.mc(
Expand Down
2 changes: 1 addition & 1 deletion R/bandwidth_selection_cvl_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ bw_cvl_calc <- function(bw_range, bw_step,lines, events, w, kernel_name, method,
#' \donttest{
#' data(mtl_network)
#' data(bike_accidents)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' cv_scores <- bw_cvl_calc.mc(c(200,400),50,
#' mtl_network, bike_accidents,
#' rep(1,nrow(bike_accidents)),
Expand Down
2 changes: 1 addition & 1 deletion R/geometrical_functions_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ lixelize_lines<- function(lines, lx_length, mindist = NULL) {
#' @examples
#' \donttest{
#' data(mtl_network)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' lixels <- lixelize_lines.mc(mtl_network,150,50)
#' ## make sure any open connections are closed afterward
#' if (!inherits(future::plan(), "sequential")){
Expand Down
4 changes: 2 additions & 2 deletions R/k_functions_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ kfunctions <- function(lines, points,
#' \donttest{
#' data(main_network_mtl)
#' data(mtl_libraries)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' result <- kfunctions.mc(main_network_mtl, mtl_libraries,
#' start = 0, end = 2500, step = 10,
#' width = 200, nsim = 50,
Expand Down Expand Up @@ -960,7 +960,7 @@ cross_kfunctions <- function(lines, pointsA, pointsB,
#' data(main_network_mtl)
#' data(mtl_libraries)
#' data(mtl_theatres)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' result <- cross_kfunctions.mc(main_network_mtl, mtl_libraries, mtl_theatres,
#' start = 0, end = 2500, step = 10, width = 250,
#' nsim = 50, conf_int = 0.05, digits = 2,
Expand Down
2 changes: 1 addition & 1 deletion R/knn_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ network_knn <- function(origins, lines, k, destinations = NULL, maxdistance = 0,
#' \donttest{
#' data(main_network_mtl)
#' data(mtl_libraries)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' results <- network_knn.mc(mtl_libraries, main_network_mtl,
#' k = 3, maxdistance = 1000, line_weight = "length",
#' grid_shape=c(1,1), verbose = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/neighbouring_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ network_listw <- function(origins,lines, maxdistance, method="centroid", point_d
#' @examples
#' \donttest{
#' data(mtl_network)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' listw <- network_listw.mc(mtl_network,mtl_network,maxdistance=500,
#' method = "centroid", line_weight = "length",
#' dist_func = 'squared inverse', matrice_type='B', grid_shape = c(2,2))
Expand Down
2 changes: 1 addition & 1 deletion R/nkde_execution_functions_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ nkde <- function(lines, events, w, samples, kernel_name, bw, adaptive=FALSE, tri
#' \donttest{
#' data(mtl_network)
#' data(bike_accidents)
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#' lixels <- lixelize_lines(mtl_network,200,mindist = 50)
#' samples <- lines_center(lixels)
#' densities <- nkde.mc(mtl_network,
Expand Down
2 changes: 1 addition & 1 deletion R/temporal_nkde_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ tnkde <- function(lines, events, time_field, w, samples_loc, samples_time, kerne
#' # choosing sample in times (every 10 days)
#' sample_time <- seq(0, max(bike_accidents$Time), 10)
#'
#' future::plan(future::multisession(workers=2))
#' future::plan(future::multisession(workers=1))
#'
#' # calculating the densities
#' tnkde_densities <- tnkde.mc(lines = mtl_network,
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ listw <- network_listw(bike_accidents,
# using the matrix to find isolated accidents (more than 500m)
no_link <- sapply(listw$neighbours, function(n){
if(n == 0){
if(length(n) == 0){
return(TRUE)
}else{
return(FALSE)
Expand Down
92 changes: 46 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[![R-CMD-check](https://github.com/JeremyGelb/spNetwork/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/JeremyGelb/spNetwork/actions/workflows/R-CMD-check.yaml)

[![](https://img.shields.io/badge/devel%20version-0.4.3.6-green.svg)](https://jeremygelb.github.io/spNetwork/)
[![](https://img.shields.io/badge/devel%20version-0.4.3.7-green.svg)](https://jeremygelb.github.io/spNetwork/)
[![](https://www.r-pkg.org/badges/version/spNetwork?color=blue)](https://cran.r-project.org/package=spNetwork)
[![](http://cranlogs.r-pkg.org/badges/grand-total/spNetwork?color=blue)](https://cran.r-project.org/package=spNetwork)
[![](http://cranlogs.r-pkg.org/badges/last-month/spNetwork?color=green)](https://cran.r-project.org/package=spNetwork)
Expand Down Expand Up @@ -54,31 +54,31 @@ geographical networks. This type of network have spatial coordinates
associated with their nodes. They can be directed or undirected. In the
actual development version the implemented methods are:

- Network Kernel Density Estimate, a method estimating density of a
point pattern constrained on a network (see the vignettes [Network
Kernel Density
Estimate](https://jeremygelb.github.io/spNetwork/articles/NKDE.html)
and [Details about
NKDE](https://jeremygelb.github.io/spNetwork/articles/NKDEdetailed.html)).
- Temporal Network Kernel Density Estimate, a temporal extension of
the previous methods [Temporal Network Kernel Density
Estimate](https://jeremygelb.github.io/spNetwork/articles/TNKDE.html).
- Spatial weight matrices based on network distances, which can be
used in a great number of traditional methods in spatial analysis
(see the vignette [Spatial Weight
Matrices](https://jeremygelb.github.io/spNetwork/articles/SpatialWeightMatrices.html)).
- Network k Functions, used to investigate the spatial distribution of
a set of points on a network at several scales (see the vignette
[Network k
Functions](https://jeremygelb.github.io/spNetwork/articles/KNetworkFunctions.html)).
- K nearest neighbours, to calculate for each point on a network its K
nearest neighbour (see the function `network_knn`).
- Graph analysis, using the functions of the package **igraph** (see
the vignette [Building
graphs](https://jeremygelb.github.io/spNetwork/articles/NetworkBuilding.html))
- Isochrones, to delineate accessible area around points localized on
a network (see the vignette [Calculating
isochrones](https://jeremygelb.github.io/spNetwork/articles/Isochrones.html))
- Network Kernel Density Estimate, a method estimating density of a
point pattern constrained on a network (see the vignettes [Network
Kernel Density
Estimate](https://jeremygelb.github.io/spNetwork/articles/NKDE.html)
and [Details about
NKDE](https://jeremygelb.github.io/spNetwork/articles/NKDEdetailed.html)).
- Temporal Network Kernel Density Estimate, a temporal extension of the
previous methods [Temporal Network Kernel Density
Estimate](https://jeremygelb.github.io/spNetwork/articles/TNKDE.html).
- Spatial weight matrices based on network distances, which can be used
in a great number of traditional methods in spatial analysis (see the
vignette [Spatial Weight
Matrices](https://jeremygelb.github.io/spNetwork/articles/SpatialWeightMatrices.html)).
- Network k Functions, used to investigate the spatial distribution of a
set of points on a network at several scales (see the vignette
[Network k
Functions](https://jeremygelb.github.io/spNetwork/articles/KNetworkFunctions.html)).
- K nearest neighbours, to calculate for each point on a network its K
nearest neighbour (see the function `network_knn`).
- Graph analysis, using the functions of the package **igraph** (see the
vignette [Building
graphs](https://jeremygelb.github.io/spNetwork/articles/NetworkBuilding.html))
- Isochrones, to delineate accessible area around points localized on a
network (see the vignette [Calculating
isochrones](https://jeremygelb.github.io/spNetwork/articles/Isochrones.html))

Calculation on network can be long, efforts were made to reduce
computation time by implementing several functions with **Rcpp** and
Expand All @@ -103,21 +103,21 @@ devtools::install_github("JeremyGelb/spNetwork")
The packages uses mainly the following packages in its internal
structure :

- igraph
- sf
- future
- future.apply
- data.table
- Rcpp
- RcppArmadillo
- BH
- igraph
- sf
- future
- future.apply
- data.table
- Rcpp
- RcppArmadillo
- BH

## Some examples

We provide here some short examples of several features. Please, check
the vignettes for more details.

- realizing a kernel network density estimate
- realizing a kernel network density estimate

``` r
library(spNetwork)
Expand Down Expand Up @@ -162,7 +162,7 @@ Estimate](https://jeremygelb.github.io/spNetwork/articles/TNKDE.html)

<img src="vignettes/images/animated_map.gif" width="75%" style="display: block; margin: auto;" />

- Building a spatial matrix based on network distance
- Building a spatial matrix based on network distance

``` r
library(spdep)
Expand All @@ -180,7 +180,7 @@ listw <- network_listw(bike_accidents,

# using the matrix to find isolated accidents (more than 500m)
no_link <- sapply(listw$neighbours, function(n){
if(n == 0){
if(length(n) == 0){
return(TRUE)
}else{
return(FALSE)
Expand All @@ -203,7 +203,7 @@ Note that you can use this in every spatial analysis you would like to
perform. With the converter function of spdep (like listw2mat), you can
convert the listw object into regular matrix if needed

- Calculating k function
- Calculating k function

``` r
# loading the data
Expand All @@ -229,11 +229,11 @@ suggestion or if you encounter a bug.

Features that will be added to the package in the future:

- temporal NKDE, a two dimensional kernel density estimation in
network space and time
- rework for using `sf` objects rather than `sp` (`rgeos` and
`maptools` will be deprecated in 2023). This work is undergoing,
please report any bug or error in the new documentation.
- temporal NKDE, a two dimensional kernel density estimation in network
space and time
- rework for using `sf` objects rather than `sp` (`rgeos` and `maptools`
will be deprecated in 2023). This work is undergoing, please report
any bug or error in the new documentation.

## Reporting a bug

Expand All @@ -250,7 +250,7 @@ guidelines:

## Authors

- **Jeremy Gelb** - *Creator and maintainer*
- **Jeremy Gelb** - *Creator and maintainer*

## Contribute

Expand Down Expand Up @@ -283,5 +283,5 @@ License](https://github.com/JeremyGelb/spNetwork/blob/master/LICENSE.txt).

## Acknowledgments

- Hat tip to Philippe Apparicio for his support during the development
- Hat tip to Hadley Wickham and his helpful book *R packages*
- Hat tip to Philippe Apparicio for his support during the development
- Hat tip to Hadley Wickham and his helpful book *R packages*
2 changes: 1 addition & 1 deletion man/bw_cv_likelihood_calc.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/bw_cvl_calc.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/bw_tnkde_cv_likelihood_calc.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cross_kfunctions.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion man/kfunctions.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/lixelize_lines.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/network_knn.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/network_listw.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/nkde.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/spNetwork-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tnkde.mc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test_bw_selection_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ test_that("Testing that bw selection by cv-likelihood gives the same score in si
lines <- subset(mtl_network, inter_idx2)

## multicore cv score
future::plan(future::multisession(workers=2))
future::plan(future::multisession(workers=1))

cv_scores.mc <- bw_cv_likelihood_calc.mc(c(200,400),100,
lines, events,
Expand Down
Loading

0 comments on commit 2a53b75

Please sign in to comment.