Get or set weight field in SpatialLinesNetwork
Get or set value of weight field in SpatialLinesNetwork
weightfield(x) weightfield(x, varname) <- value weightfield(x, varname) <- value ## S4 method for signature 'SpatialLinesNetwork' weightfield(x) ## S4 method for signature 'sfNetwork' weightfield(x) ## S4 replacement method for signature 'SpatialLinesNetwork,ANY' weightfield(x) <- value ## S4 replacement method for signature 'sfNetwork,ANY' weightfield(x) <- value ## S4 replacement method for signature 'SpatialLinesNetwork,character' weightfield(x, varname) <- value ## S4 replacement method for signature 'sfNetwork,character' weightfield(x, varname) <- value
x |
SpatialLinesNetwork to use |
varname |
The name of the variable to set/use. |
value |
Either the name of the variable to use as the weight field or
a dataframe or vector containing the weights to use if |
These functions manipulate the value of weightfield in a SpatialLinesNetwork. When changing the value of weightfield, the weights of the graph network are updated with the values of the corresponding variables.
# with sp objects data(routes_fast) rnet <- overline(routes_fast, attrib = "length") sln <- SpatialLinesNetwork(rnet) weightfield(sln) <- "length" weightfield(sln, "randomnum") <- sample(1:10, size = nrow(sln@sl), replace = TRUE) data(routes_fast_sf) rnet <- overline(routes_fast_sf, attrib = "length") sln <- SpatialLinesNetwork(rnet) weightfield(sln) <- "length" sln@sl$randomnum <- sample(1:10, size = nrow(sln@sl), replace = TRUE) weightfield(sln) <- "randomnum" # todo: show the difference that it makes
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.