Skip to contents

Unnests the comma seperated braid_id column into individual rows for each braid ID/comid pairing. This function will unnest the nested braid_ids column that is the output of calling 'find_braids()' with 'nested = TRUE', essentially giving the output of running 'nested = FALSE'.

Usage

unnpack_braids(braids, into_list = FALSE)

Arguments

braids

dataframe or sf dataframe containing a "comid" and "braid_id" column

into_list

logical, if TRUE, unpacked braid_ids and corresponding comids are returned as a list. Default is FALSE

Value

dataframe or list

Examples

 if (FALSE) {
# get a NHDPlus flowlines network
net <- nhdplusTools::navigate_network(start = 101, mode = "UT", distance_km = 100)

# Drop some columns for clarity
net <- dplyr::select(net, comid, divergence, fromnode, tonode)

# locate braids in the network and specify nested braid_id return
braids <- find_braids(net, add = TRUE, nested = TRUE)

# unnest the nested braid_id column (explode the list column into individual rows)
unpacked <- unnpack_braids(braids)
}