Learn R Programming

sarp.snowprofile.alignment (version 1.0.2)

ddateDistance: Deposition Date Distance

Description

Calculate the distance (i.e. dissimilarity) between two deposition dates

Usage

ddateDistance(
  ddate1,
  ddate2,
  normalizeBy = 5,
  clipWindow = FALSE,
  na.dist = 0.5
)

Arguments

ddate1

1D array of POSIX dates

ddate2

same format and length as ddate1

normalizeBy

Numeric scalar to be used for normalization, i.e. the number of days, that defines the distance value of 1

clipWindow

Should differences larger than 'normalizeBy' number of days be set to distance 'Infinity'? default FALSE.

na.dist

replace NA values with that distance

Value

An array of length(ddate1) containing the distances according to the configurations.

Examples

Run this code
# NOT RUN {
## create ddate arrays..
ddate <- as.POSIXct("2019/04/20 12:00", tz = "UTC")
ddate1 <- rep(ddate, 5)
ddate2 <- as.POSIXct(c("2019/04/12 08:00", "2019/04/16 10:00", "2019/04/20 12:00",
                       "2019/04/21 16:00", "2019/04/22 20:00"), tz = "UTC")

## .. and calculate distance:
ddateDistance(ddate1, ddate2, normalizeBy = 5)
# }

Run the code above in your browser using DataLab