Skip to content

Commit

Permalink
allow non-POSIXct and non-Date times; #135
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jan 21, 2024
1 parent 8335d8e commit 1597d12
Showing 3 changed files with 60 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -17,3 +17,5 @@ ChangeLog
^\.github$
tic.R
^\.ccache$
_pkgdown.yml
attic
27 changes: 15 additions & 12 deletions R/variogramST.R
Original file line number Diff line number Diff line change
@@ -189,18 +189,21 @@ variogramST.STIDF <- function (formula, data, tlags, cutoff,
m = model.frame(terms(formula), as(data, "data.frame"))

diffTime <- diff(index(data))
timeScale <- units(diffTime)
if(missing(tunit))
warning(paste("The argument 'tunit' is missing: tlags are assumed to be given in ", timeScale, ".",sep=""))
else {
stopifnot(tunit %in% c("secs", "mins", "hours", "days", "weeks"))
units(diffTime) <- tunit
timeScale <- tunit
}
diffTime <- as.numeric(diffTime)
if (missing(twindow)) {
twindow <- round(2 * max(tlags, na.rm=TRUE)/mean(diffTime,na.rm=TRUE),0)
}
if (inherits(diffTime, "difftime")) {
timeScale <- units(diffTime)
if(missing(tunit))
warning(paste("The argument 'tunit' is missing: tlags are assumed to be given in ", timeScale, ".",sep=""))
else {
stopifnot(tunit %in% c("secs", "mins", "hours", "days", "weeks"))
units(diffTime) <- tunit
timeScale <- tunit
}
diffTime <- as.numeric(diffTime)
} else if (!missing(tunit))
stop("'tunit' ignored, as time values are not of class POSIXct or Date")

if (missing(twindow))
twindow <- round(2 * max(tlags, na.rm=TRUE) / mean(diffTime, na.rm = TRUE), 0)

nData <- nrow(data)

43 changes: 43 additions & 0 deletions inst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
2024-01-17 edzer <edzer.pebesma@uni-muenster.de>

* .github/workflows/tic.yml: update

2024-01-17 edzer <edzer.pebesma@uni-muenster.de>

* .github/workflows/tic.yml: bump GA

2024-01-11 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* : Merge pull request #133 from olivroy/patch-2 Update pkgdown config

2024-01-11 olivroy <52606734+olivroy@users.noreply.github.com>

* .github/workflows/pkgdown.yaml: Create pkgdown.yaml

2024-01-10 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* : Merge pull request #132 from olivroy/patch-1 Add website to DESCRIPTION

2023-11-25 edzer <edzer.pebesma@uni-muenster.de>

* man/variogramST.Rd: doc issues

2023-11-25 edzer <edzer.pebesma@uni-muenster.de>

* demo/pcb_sf.R: start of conversion

2023-11-25 edzer <edzer.pebesma@uni-muenster.de>

* demo/00Index, man/jura.Rd, tests/stars.Rout.save: clean up tests,
CRAN doc NOTE

2023-04-06 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* DESCRIPTION: bump version after CRAN release

2023-04-06 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* inst/CITATION, inst/ChangeLog, man/sic2004.Rd,
tests/stars.Rout.save, tests/unproj.R, tests/unproj.Rout.save,
tests/windst.R, tests/windst.Rout.save: fixes for CRAN release 2.1-1

2023-04-05 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* : commit a2fe679ea5043200479253f168dc9a9f596d8baa Author: Edzer

0 comments on commit 1597d12

Please sign in to comment.