MergeXobs {HYPEtools} | R Documentation |
Merge two Xobs data frames
Description
Function to merge two Xobs data frames, with handling of overlapping time periods and time periods gaps as well as merging of common columns.
Usage
MergeXobs(x, y, comment = "")
Arguments
x , y |
Data frames of class |
comment |
Character string, will be added to the result as attribute |
Details
MergeXobs
handles time steps of different lengths (e.g. daily, hourly), but requires identical time
step lengths from both inputs data frames. The functions expects data frames of class HypeXobs
or data frames with comparable structure and will throw a warning if the class attribute is missing.
In case of common columns (identical observation variable and SUBID combinations in x
and y
),
values from columns in x
will take precedence, and values from y
will only be added if
x
values are missing
Value
MergeXobs
returns a data frame with attributes for Xobs data.
Examples
# Import dummy data, add new observations to second Xobs table
te1 <- ReadXobs(filename = system.file("demo_model", "Xobs.txt", package = "HYPEtools"))
te2 <- ReadXobs(filename = system.file("demo_model", "Xobs.txt", package = "HYPEtools"))
te2$WSTR_40541[1:10] <- runif(n = 10, 50, 100)
MergeXobs(x = te1, y = te2)