R/revSGe.R

Defines functions revSGe

Documented in revSGe

revSGe <- function(SG, eID) {
 # reverse the coordinates of the polylines in a SpatialGraph
 FID <- row.names(SG@e@data)
 lid <- match(eID,FID)
 for (i in lid) {
     coo <-  coordinates(SG@e[i,])[[1]][[1]]
     coo <- coo[nrow(coo):1,]
     SG@e@lines[[i]]@Lines <- list(Line(coo))
     SG@e@data[i,c('v0','v1')] <- SG@e@data[i,c('v1','v0')]
  }
  return(SG)
} # end function revSGe

Try the SpatialGraph package in your browser

Any scripts or data that you put into this service are public.

SpatialGraph documentation built on Sept. 28, 2023, 5:08 p.m.