From 42c2bb48b3534ebb43a992b37ed3c683050e4aab Mon Sep 17 00:00:00 2001 From: Brandon Hill Date: Sat, 26 Sep 2015 12:22:40 -0700 Subject: [PATCH] PUBDEV-2150 Imports time columns from H2O as Date columns in R. --- h2o-r/h2o-package/R/frame.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/h2o-r/h2o-package/R/frame.R b/h2o-r/h2o-package/R/frame.R index 555b19795c0b..842162a1469a 100644 --- a/h2o-r/h2o-package/R/frame.R +++ b/h2o-r/h2o-package/R/frame.R @@ -1730,7 +1730,10 @@ as.data.frame.Frame <- function(x, ...) { # Substitute NAs for blank cells rather than skipping df <- read.csv((tcon <- textConnection(ttt)), blank.lines.skip = FALSE, na.strings = "", colClasses = colClasses, ...) close(tcon) - # FIXME now convert all date columns to POSIXct + # Convert all date columns to POSIXct + dates <- attr(x, "types") %in% "time" + if (length(dates) > 0) # why do some frames come in with no attributes but many columns? + for (i in 1:length(dates)) { if (dates[[i]]) class(df[[i]]) = "POSIXct" } df }