createObsDataframe: Creates an empty data fame for CRHM obs

View source: R/createObsDataframe.R

createObsDataframeR Documentation

Creates an empty data fame for CRHM obs

Description

Creates a data fame to hold observations. All values are initially set to NA_real_. Once the data fame has been created, it may be filled from other data fames by imputation.

Usage

createObsDataframe(
  start.date,
  end.date,
  timestep = 1,
  variables = c("t", "rh", "u", "p"),
  reps = 1,
  timezone = "",
  logfile = ""
)

Arguments

start.date

Required. Starting date, in the format Y-m-d, d/m/Y, d-m-Y, d B Y, d b Y, d-B-Y, d-b-Y, B d, Y, or b d, Y, where Y = year, m = month number, B = capitalized month name, b = lower case month name, d = day number.

end.date

Required. Ending date,, in the format d/m/Y, d-m-Y, d B Y, d b Y, d-B-Y, d-b-Y, B d, Y, or b d, Y, where Y = year, m = month number, B = capitalized month name, b = lower case month name, d = day number.

timestep

Optional. Time interval between values in hours. The default value is 1 hour. The interval can be less than 1 hour.

variables

Optional. vector containing the names of variables to be created. The default values are t, rh, u, and p.

reps

Optional. The number of repetitions for each value. The default is 1.

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.

logfile

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

Details

The names for the variables in the data fame are derived from the specified variables, and the number of reps. For example if the default variable names are used, with 2 reps, then the variables created will be t.1, t.2, rh.1, rh.2, u.1, u.2, p.1, and p.2.

Value

If successful, the function returns a CRHM data fame with the specified number of each variable, with values set to be NA. If unsuccessful, returns the value FALSE.

Author(s)

Kevin Shook

See Also

impute

Examples

vars <- c('t','rh','u')
stoon <- createObsDataframe('1/1/1960', '31/12/1960', variables=vars, reps=2, timezone='etc/GMT+6')

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