merge: Merge HypeGeoData object

mergeR Documentation

Merge HypeGeoData object

Description

Merge an imported HYPE GeoData table of class link{HypeGeoData} with another data frame.

Usage

## S3 method for class 'HypeGeoData'
merge(x, y, all.x = TRUE, sort = NA, ...)

Arguments

x

HypeGeoData data frame, HYPE GeoData table to be extended with new columns.

y

Data frame, with mandatory SUBID column.

all.x

Logical, keep all rows from x. Defaults to TRUE, as opposed to default method, thus extending the GeoData table with columns in y.

sort

Logical, result sorting by by columns. In addition to the default method's choices TRUE, FALSE, a third option NA (default) will use sorting of x for results. I.e. a sorted GeoData table will be runnable in HYPE even after merging.

...

Arguments passed to S3 method for data frames, see merge and Details.

Details

merge.HypeGeoData allows to merge new columns to an existing HYPE GeoData table, while preserving the HypeGeoData class attribute. Duplicate columns are marked with a ".y"-suffix for the merged y data frame.

The following arguments of the default method are hard-coded:

  • by, by.x, by.y, set to "SUBID"

  • suffixes, set to c("", ".y")

The method warns if any of these arguments is supplied by the user. To override, use the GeoData table as argument y or call the data frame method explicitly (merge.data.frame()).

Value

A HypeGeoData data frame.

See Also

merge, the S3 generic function.

Examples

# import and create dummy data
te1 <- ReadGeoData(filename = system.file("demo_model",
"GeoData.txt", package = "HYPEtools"))
te2 <- data.frame(SUBID = sample(x = te1$SUBID, size = 10),
loc_vol = runif(n = 10, 10, 50))
merge(x = te1, y = te2)


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.