Commit 2ba6cc1f authored by Enrico Schumann's avatar Enrico Schumann

Version: 0.4-5

write_ts_table: when ts_table has zero rows,
return(0) at once

write_ts_table: suppress scientific notation when
writing to file

print.ts_table: suppress warnings when ts_table
has zero rows
parent f5496609
2017-05-09 Enrico Schumann <es@enricoschumann.net>
* DESCRIPTION (Version): 0.4-5
* R/functions.R (write_ts_table): suppress
scientific notation when writing to file
* R/functions.R (write_ts_table): when ts_table
has zero rows, return(0) at once
(print.ts_table): suppress warnings when
......@@ -7,7 +12,7 @@
2017-05-08 Enrico Schumann <es@enricoschumann.net>
* DESCRIPTION (Version): Version: 0.4-4
* DESCRIPTION (Version): 0.4-4
(Suggests): add MonetDBLite
* R/functions.R (read_ts_tables): update for
......@@ -55,7 +60,7 @@
2016-12-10 Enrico Schumann <es@enricoschumann.net>
* DESCRIPTION (Version): Version: 0.3-0
* DESCRIPTION (Version): 0.3-0
* R/functions.R (write_ts_table): new argument
'add'. If TRUE, only data for timestamps not in
......@@ -78,7 +83,7 @@
2016-12-05 Enrico Schumann <es@enricoschumann.net>
* DESCRIPTION (Version): Version: 0.2-0
* DESCRIPTION (Version): 0.2-0
* README.org: add file
......@@ -106,7 +111,7 @@
2016-11-25 Enrico Schumann <es@enricoschumann.net>
* DESCRIPTION (Version): Version: 0.1-1
* DESCRIPTION (Version): 0.1-1
* R/functions.R (as.ts_table): add function
(as.ts_table.zoo): add method
......
Package: tsdb
Type: Package
Title: Terribly-Simple Data Base for Time Series
Version: 0.4-4
Date: 2017-05-08
Version: 0.4-5
Date: 2017-05-09
Maintainer: Enrico Schumann <es@enricoschumann.net>
Authors@R: person("Enrico", "Schumann",
role = c("aut", "cre"),
......
......@@ -58,12 +58,14 @@ write_ts_table <- function(x, dir, file,
backend = "csv") {
if (!(inherits(x, "ts_table")))
stop(sQuote("x"), " must be a ts_table")
save.scipen <- options(scipen = 1e5)
on.exit(options(scipen = save.scipen))
timestamp <- .timestamp(x)
columns <- .columns(x)
backend <- tolower(backend)
ans <- nrow(x)
ans <- dim(x)[1L] ## a ts_table is always a matrix
if (ans == 0L)
return(invisible(0L))
if (backend == "csv") {
......@@ -81,7 +83,7 @@ write_ts_table <- function(x, dir, file,
ans <- sum(new)
timestamp <- c(ttime(in_db$timestamp),
timestamp[new])
x <- rbind(in_db$data, x[new, ])
x <- rbind(in_db$data, x[new, , drop = FALSE])
if (is.unsorted(timestamp)) {
ii <- order(timestamp)
timestamp <- timestamp[ii]
......@@ -91,7 +93,9 @@ write_ts_table <- function(x, dir, file,
}
if (file.exists(dfile) && !overwrite && !add) {
ans <- 0
message("file exists; use ", sQuote("overwrite = TRUE"), " to overwrite file")
message("file exists; use ", sQuote("add = TRUE"),
" or ", sQuote("overwrite = TRUE"),
" to change/overwrite file")
} else if (add && sum(new) == 0L) {
ans <- 0
} else {
......
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