Learn R Programming

vein (version 1.1.3)

emis_to_streets: Emis to streets distribute top-down emissions into streets

Description

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.

Usage

emis_to_streets(streets, dfemis, by = "ID", stpro, verbose = TRUE)

Arguments

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.

See Also

add_polid

Examples

Run this code
if (FALSE) {
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)
}

Run the code above in your browser using DataLab