Skip to content

Commit 1597d12

Browse files
committed
allow non-POSIXct and non-Date times; #135
1 parent 8335d8e commit 1597d12

File tree

3 files changed

+60
-12
lines changed

3 files changed

+60
-12
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ ChangeLog
1717
^\.github$
1818
tic.R
1919
^\.ccache$
20+
_pkgdown.yml
21+
attic

R/variogramST.R

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,21 @@ variogramST.STIDF <- function (formula, data, tlags, cutoff,
189189
m = model.frame(terms(formula), as(data, "data.frame"))
190190

191191
diffTime <- diff(index(data))
192-
timeScale <- units(diffTime)
193-
if(missing(tunit))
194-
warning(paste("The argument 'tunit' is missing: tlags are assumed to be given in ", timeScale, ".",sep=""))
195-
else {
196-
stopifnot(tunit %in% c("secs", "mins", "hours", "days", "weeks"))
197-
units(diffTime) <- tunit
198-
timeScale <- tunit
199-
}
200-
diffTime <- as.numeric(diffTime)
201-
if (missing(twindow)) {
202-
twindow <- round(2 * max(tlags, na.rm=TRUE)/mean(diffTime,na.rm=TRUE),0)
203-
}
192+
if (inherits(diffTime, "difftime")) {
193+
timeScale <- units(diffTime)
194+
if(missing(tunit))
195+
warning(paste("The argument 'tunit' is missing: tlags are assumed to be given in ", timeScale, ".",sep=""))
196+
else {
197+
stopifnot(tunit %in% c("secs", "mins", "hours", "days", "weeks"))
198+
units(diffTime) <- tunit
199+
timeScale <- tunit
200+
}
201+
diffTime <- as.numeric(diffTime)
202+
} else if (!missing(tunit))
203+
stop("'tunit' ignored, as time values are not of class POSIXct or Date")
204+
205+
if (missing(twindow))
206+
twindow <- round(2 * max(tlags, na.rm=TRUE) / mean(diffTime, na.rm = TRUE), 0)
204207

205208
nData <- nrow(data)
206209

inst/ChangeLog

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
2024-01-17 edzer <[email protected]>
2+
3+
* .github/workflows/tic.yml: update
4+
5+
2024-01-17 edzer <[email protected]>
6+
7+
* .github/workflows/tic.yml: bump GA
8+
9+
2024-01-11 Edzer Pebesma <[email protected]>
10+
11+
* : Merge pull request #133 from olivroy/patch-2 Update pkgdown config
12+
13+
2024-01-11 olivroy <[email protected]>
14+
15+
* .github/workflows/pkgdown.yaml: Create pkgdown.yaml
16+
17+
2024-01-10 Edzer Pebesma <[email protected]>
18+
19+
* : Merge pull request #132 from olivroy/patch-1 Add website to DESCRIPTION
20+
21+
2023-11-25 edzer <[email protected]>
22+
23+
* man/variogramST.Rd: doc issues
24+
25+
2023-11-25 edzer <[email protected]>
26+
27+
* demo/pcb_sf.R: start of conversion
28+
29+
2023-11-25 edzer <[email protected]>
30+
31+
* demo/00Index, man/jura.Rd, tests/stars.Rout.save: clean up tests,
32+
CRAN doc NOTE
33+
34+
2023-04-06 Edzer Pebesma <[email protected]>
35+
36+
* DESCRIPTION: bump version after CRAN release
37+
38+
2023-04-06 Edzer Pebesma <[email protected]>
39+
40+
* inst/CITATION, inst/ChangeLog, man/sic2004.Rd,
41+
tests/stars.Rout.save, tests/unproj.R, tests/unproj.Rout.save,
42+
tests/windst.R, tests/windst.Rout.save: fixes for CRAN release 2.1-1
43+
144
2023-04-05 Edzer Pebesma <[email protected]>
245

346
* : commit a2fe679ea5043200479253f168dc9a9f596d8baa Author: Edzer

0 commit comments

Comments
 (0)