dt_combine: Combine PoSIXct date, time, and timezone columns into a...

View source: R/dt_combine.R

dt_combineR Documentation

Combine PoSIXct date, time, and timezone columns into a single POSIXct datetime.

Description

This function will combine POSIXct date and time values pulled from an excel using contin_import to make a POSIXct datetime. There are various options on how to handle the time and timezone column. If the datetime falls in a daylight savings break NA is returned.

Usage

dt_combine(
  df,
  date_col = "Activity.Start.Date",
  time_col = "Activity.Start.Time",
  time_val = NULL,
  tz_col = "Activity.Start.End.Time.Zone"
)

Arguments

df

Data frame to be evaluated.

date_col

Column name in df holding the POSIXct date values. Default is "Activity.Start.Date"

time_col

Column name in df holding the POSIXct time values. Default is "Activity.Start.Time". If NULL uses date_col or time_val if provided.

time_val

string in format 'hh:mm:ss' representing the time to use for all rows. Default is NULL. If NULL uses date_col or time_col if provided.

tz_col

Column name in df holding the timezone string values. Acceptable values include "PST", "PDT", "MST", "MDT" or Olson Names such as 'America/Los_Angeles' for Pacific Time zone or 'America/Boise' for Mountain time zone. See OlsonNames for more info. Default is tz_col="Activity.Start.End.Time.Zone".

Value

vector of POSIXct datetime


DEQrmichie/odeqcdr documentation built on Feb. 15, 2025, 10:01 a.m.