dateToDatetime: Converts an R date to a datetime

View source: R/dateToDatetime.R

dateToDatetimeR Documentation

Converts an R date to a datetime

Description

The aggDataframe function produces non-standard data frames, which have dates rather than datetimes as their first column. This function will convert a data frame with dates in the first column to have datetimes with the time being set to a constant value.

Usage

dateToDatetime(dataframe, hour = 0, timezone = "", logfile = "")

Arguments

dataframe

Required. A data frame. The first name of the column must be date, and it must be standard R date.

hour

Optional. The hour to be used for the datetime values. Default is 0.

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.

Value

If successful, returns a data frame where the first column is a standard CRHMr datetime. If unsuccessful, returns an error.

Author(s)

Kevin Shook

See Also

aggDataframe datetimeToDate

Examples

Badlake.radiation.daily <- aggDataframe(BadLake7376, period='daily',
columns=c(6,7,8), funs=c('mean'))
BadLake.datetime <- dateToDatetime(Badlake.radiation.daily, timezone='CST')


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