hy: Create a hy Fabric S3 Object

View source: R/hy.R

hyR Documentation

Create a hy Fabric S3 Object

Description

converts a compatible dataset into a fabric s3 class. Automatically detects the network representation and classifies the result as the most specific hydroloom subclass (e.g. hy_topo, hy_node). With add_topo = TRUE, also auto-builds topology (e.g. toid from fromnode/tonode).

Usage

hy(x, clean = FALSE, add_topo = FALSE)

Arguments

x

data.frame network compatible with hydroloom_names.

clean

logical if TRUE, geometry and non-hydroloom compatible attributes will be removed.

add_topo

logical. If TRUE, auto-build topology (e.g. toid from fromnode/tonode) and classify into subclass hierarchy. If FALSE (default), classify based on existing columns only without constructing new attributes.

Value

hy object with attributes compatible with the hydroloom package.

Examples

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

hy(x)

hy(x, clean = TRUE)[1:10, ]

attr(hy(x), "orig_names")

# auto-build toid from fromnode/tonode
hy(x, add_topo = TRUE)


hydroloom documentation built on Aug. 4, 2026, 1:07 a.m.