Commit 7c5c49cc authored by Enrico Schumann's avatar Enrico Schumann

[read_ts_tables] Rename argument 'fread' to 'read.fn'

Default is NULL. To use package 'data.table',
set 'read.fn' to "fread".
parent f4ea387e
2019-03-20 Enrico Schumann <es@enricoschumann.net>
* R/functions.R (read_ts_tables): rename
argument 'fread' to 'read.fn', with default
NULL. To use package 'data.table', set it to
"fread".
2019-03-11 Enrico Schumann <es@enricoschumann.net>
* R/functions.R (as.ts_table.ts_table): add method
......
......@@ -2,7 +2,7 @@ Package: tsdb
Type: Package
Title: Terribly-Simple Data Base for Time Series
Version: 0.6-0
Date: 2019-03-11
Date: 2019-03-20
Maintainer: Enrico Schumann <es@enricoschumann.net>
Authors@R: person(given = "Enrico", family = "Schumann",
role = c("aut", "cre"),
......
......@@ -167,7 +167,7 @@ read_ts_tables <- function(file, dir, t.type = "guess",
drop.weekends = TRUE,
column.names = "%dir%/%file%::%column%",
backend = "csv",
fread = FALSE) {
read.fn = NULL) {
backend <- tolower(backend)
......@@ -236,7 +236,7 @@ read_ts_tables <- function(file, dir, t.type = "guess",
if (drop.weekends)
timestamp <- timestamp[is_businessday(timestamp)]
} else if (t.type == "POSIXct") {
warning("'Oh boy', said Helen, 'that's not really supported.'")
warning("'Oh boy', said Helen, 'that's not really supported/tested.'")
start <- if (missing(start))
ttime(timestamp1,
from = "numeric", to = "POSIXct")
......@@ -255,17 +255,19 @@ read_ts_tables <- function(file, dir, t.type = "guess",
results <- array(NA_real_,
dim = c(length(timestamp), length(dfile)*nc))
for (i in seq_along(dfile)) {
if (fread)
if (is.null(read.fn))
tmp <- data.table::fread(dfile[[i]],
sep = ",",
header = TRUE,
data.table = FALSE)
else
else if (read.fn == "fread")
tmp <- read.table(dfile[[i]],
sep = ",",
stringsAsFactors = FALSE,
header = TRUE,
colClasses = "numeric")
else
stop("unknown ", sQuote("read.fn"))
ii <- fmatch(tmp[[1L]], timestamp, nomatch = 0L)
tmp.names <- colnames(tmp)
if (!all(columns %in% tmp.names)) {
......
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