extendObs: Extends an obs data frame

View source: R/extendObs.R

extendObsR Documentation

Extends an obs data frame

Description

This function extends a CRHMr obs data frame to include the specified dates. All added values are set to be NA_real_. The purpose of this function is to create locations for data that can be infilled or imputed from another data set.

Usage

extendObs(
  obs,
  startDate = "",
  endDate = "",
  timezone = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

obs

Required. The CRHMr obs data frame to be extended.

startDate

Optional. The starting date for the obs data frame. Can either be a year as a number (e.g. 1995) or a date in Y-m-d format, i.e. 1995-06-01. Either the startDate or the endDate, or both, must be specified.

endDate

Optional. The ending date for the obs data frame. Can either be a year as a number (e.g. 1995) or a date in Y-m-d format, i.e. 1995-07-01.

timezone

Required. The name of the timezone of the data as a character string. This should be the timezone of your data, but omitting daylight savings time. Note that the timezone code is specific to your OS. To avoid problems, you should use a timezone without daylight savings time. Under Linux, you can use CST and MST for Central Standard or Mountain Standard time, respectively. Under Windows or OSX, you can use etc/GMT+6 or etc/GMT+7 for Central Standard and Mountain Standard time. DO NOT use America/Regina as the time zone, as it includes historical changes between standard and daylight savings time.

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 modified version of the obs data frame. The missing values in the specified data frame are replaced by NA_real_ values. If unsuccessful, returns an error.

Author(s)

Kevin Shook

Examples

BadLake7378 <- extendObs(BadLake7376, endDate = "1978-01-01", timezone = "CST")

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