appendObs: Appends two CRHM obs data frames

View source: R/appendObs.R

appendObsR Documentation

Appends two CRHM obs data frames

Description

This function joins two data frames of CRHM obs. The data frames must have the same number of columns, and the variables must be in the same order. The usual reason is for joining two data frames of differing periods. The primary and secondary data frames may be of any time periods. Where there are two values for a given datetime, the primary values are used. Rows of missing values at the beginning and end of the time series are deleted.

Usage

appendObs(primaryObs, secondaryObs, trim = TRUE, quiet = TRUE, logfile = "")

Arguments

primaryObs

Required. The primary CRHMr data frame of obs values.

secondaryObs

Required. The secondary obs data frame. Note that both data frames must have the same time intervals.

trim

Optional. If set to TRUE (the default) then rows missing all values at the beginnings and/or ends of the obs data frames will be omitted.

quiet

Optional. Suppresses display of messages, except for errors. If you are calling this function in an R script, you will usually leave quiet=TRUE (i.e. the default). If you are working interactively, you will probably want to set quiet=FALSE.

logfile

Optional. Name of the file to be used for logging the action. Normally not used.

Value

If successful, returns a data frame of values combined from the primaryObs and secondaryObs data frames. If unsuccessful, returns an error.

Note

In addition to the usual notation in the logfile, this function also writes a separate file which summarises the new data frame. The summaries are also printed to the screen, if quiet=FALSE, the logfile also contains a complete listing of the source of each value in the infilled data frame. Each value is listed as being primary (from the primaryObs data frame), secondary (derived from the secondaryObs data frame) or NA (missing).

Author(s)

Kevin Shook

Examples

## Not run: 
broadview <- appendObs(broad2855, broad2856)

## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.