View source: R/emis_to_streets.R
emis_to_streets | R Documentation |
emis_to_streets
allocates emissions proportionally to
each feature. "Spatial" objects are converter to "sf" objects. Currently,
'LINESTRING' or 'MULTILINESTRING' supported. The emissions are distributed
in each street.
emis_to_streets(streets, dfemis, by = "ID", stpro, verbose = TRUE)
streets |
sf object with geometry 'LINESTRING' or 'MULTILINESTRING'. Or SpatialLinesDataFrame |
dfemis |
data.frame with emissions |
by |
Character indicating the columns that must be present in both 'street' and 'dfemis' |
stpro |
data.frame with two columns, category of streets and value. The name of the first column must be "stpro" and the sf streets must also have a column with the nam "stpro" indicating the category of streets. The second column must have the name "VAL" indicating the associated values to each category of street |
verbose |
Logical; to show more info. |
When spobj is a 'Spatial' object (class of sp), they are converted into 'sf'.
add_polid
## Not run:
data(net)
stpro = data.frame(stpro = as.character(unique(net$tstreet)),
VAL = 1:9)
dnet <- net["ldv"]
dnet$stpro <- as.character(net$tstreet)
dnet$ID <- "A"
df2 <- data.frame(BC = 10, CO = 20, ID = "A")
ste <- emis_to_streets(streets = dnet, dfemis = df2)
sum(ste$ldv)
sum(net$ldv)
sum(ste$BC)
sum(df2$BC)
ste2 <- emis_to_streets(streets = dnet, dfemis = df2, stpro = stpro)
sum(ste2$ldv)
sum(net$ldv)
sum(ste2$BC)
sum(df2$BC)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.