Maintenance scheduled for Thursday, January 27th at 15:00 MST. Expected downtime <1 hour.

Commit edeff72b authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #257 from wdwatkins/master

Fixed issue with new readr
parents 29706b1b bba77e9a
......@@ -43,12 +43,11 @@
#' @export
#' @import utils
#' @import stats
#' @import lubridate
#' @importFrom dplyr left_join
#' @importFrom readr read_lines
#' @importFrom readr read_delim
#' @importFrom readr problems
#' @importFrom lubridate fast_strptime
#' @importFrom lubridate parse_date_time
#' @examples
#' siteNumber <- "02177000"
#' startDate <- "2012-09-01"
......@@ -117,6 +116,11 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz=""){
if(convertType){
readr.data <- suppressWarnings(read_delim(doc, skip = (meta.rows+2),delim="\t",col_names = FALSE))
#defaults to time in seconds in readr 0.2.2.9??
if(data.class(readr.data$X4)=="hms"){
td <- seconds_to_period(readr.data$X4[!is.na(readr.data$X4)])
readr.data$X4[!is.na(readr.data$X4)] <- sprintf('%02d:%02d:%02d', hour(td), minute(td), second(td))
}
} else {
readr.data <- read_delim(doc, skip = (meta.rows+2),delim="\t",col_names = FALSE, col_types = cols(.default = "c"))
}
......@@ -166,9 +170,8 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz=""){
if(all(c(paste0(i,"_dt"),paste0(i,"_tm")) %in% header.names)){
varname <- paste0(i,"_dateTime")
varval <- as.POSIXct(fast_strptime(paste(readr.data[,paste0(i,"_dt")],readr.data[,paste0(i,"_tm")]), "%Y-%m-%d %H:%M", tz = "UTC"))
varval <- parse_date_time(paste(readr.data[,paste0(i,"_dt")],readr.data[,paste0(i,"_tm")]), c("%Y-%m-%d %H:%M:%S","%Y-%m-%d %H:%M"), tz = "UTC")
if(!all(is.na(varval))){
readr.data[,varname] <- varval
tz.name <- paste0(i,"_time_datum_cd")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment