Learn R Programming

h2o (version 2.8.4.4)

as.Date.H2OParsedData: Converts a column from factor to date

Description

as.Date.H2OParsedData, Converts a column from factor to date.

Usage

## S3 method for class 'H2OParsedData':
as.Date(x, format, \dots)

Arguments

x
A factor column in an object of class H2OParsedData, or data frame to be converted.
format
A character string.
...
Additional arguments to pass to the as.Date method

Value

  • Returns a column of dates stored as the number of milliseconds since the start of January 1, 1970. Negative numbers represent the number of seconds before this time, and positive numbers represent the number of seconds afterwards. NA values are preserved.

Details

Supports all parse tokens specified for strptime, except %u, %U, %w, %W, %X and %0Sn. Format also supports local variables that evaluate to a string.

Examples

Run this code
library(h2o)
localH2O = h2o.init()
dates = c("Fri Jan 10 00:00:00 1969 -0800",
          "Tue Jan 10 04:00:00 2068 -0800",
          "Mon Dec 30 01:00:00 2002 -0800",
          "Wed Jan 1 12:00:00 2003 -0800")
df = data.frame(dates)
hdf = as.h2o(localH2O, df, "hdf", TRUE)
hdf$dates = as.Date(hdf$dates, "%c %z")
hdf$dates

Run the code above in your browser using DataLab