Learn R Programming

hydroloom (version 1.1.0)

accumulate_downstream: Accumulate Variable Downstream

Description

given a variable, accumulate according to network topology.

Usage

accumulate_downstream(x, var)

# S3 method for data.frame accumulate_downstream(x, var)

# S3 method for hy accumulate_downstream(x, var)

Value

vector of the same length as nrow(x) containing values of var accumulated downstream

Arguments

x

data.frame network compatible with hydroloom_names.

var

variable to accumulate.

Examples

Run this code
x <- sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom"))

x$totDASqKM <- accumulate_downstream(add_toids(x), "AreaSqKM")

plot(x['totDASqKM'], lwd = x$totDASqKM / 50)

Run the code above in your browser using DataLab