Skip to content

Commit

Permalink
Addresses problem raised in ropensci#240. Still need to fix NOTES for…
Browse files Browse the repository at this point in the history
… CRAN related to row_number().
  • Loading branch information
richardellison committed Dec 24, 2017
1 parent 379e308 commit b299af6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/SpatialLinesNetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ SpatialLinesNetwork.Spatial <- function(sl, uselonglat = FALSE, tolerance = 0.00
#' @export
SpatialLinesNetwork.sf <-function(sl, uselonglat = FALSE, tolerance = 0.000) {

nodes_all = sf::st_coordinates(sl)
nodecoords = line_to_points(sl) %>%
sf::st_coordinates() %>%
dplyr::as_data_frame()
nodecoords$nrow = rep(n_vertices(sl), each = 2)
nodecoords$allrownum <- dplyr::row_number(nodecoords$nrow)
nodecoords <- as.data.frame(sf::st_coordinates(sl)) %>%
dplyr::group_by(.data$L1) %>%
dplyr::mutate(nrow = n(), rownum = row_number()) %>%
dplyr::filter(.data$rownum == 1 | .data$rownum == (!!dplyr::quo(nrow))) %>%
dplyr::ungroup() %>%
dplyr::mutate(allrownum = row_number())

gdata <- coord_matches_sf(
as.matrix(
Expand Down Expand Up @@ -560,7 +560,7 @@ sum_network_routes <- function(sln, start, end, sumvars, combinations = FALSE) {
})
) %>%
sf::st_as_sf(
coords = utils::head(colnames(.data),-2),
coords = utils::head(colnames(.),-2),
crs = sf::st_crs(sln@sl)$epsg
) %>%
dplyr::group_by(.data$linenum) %>%
Expand Down

0 comments on commit b299af6

Please # to comment.