Determine which observations in a regular time series match observation in an original irregular one, accepting a given tolerance window in the time-scale. This function is internally used for regulation (functions `regul()`

, `regul.screen()`

and `regul.adj()`

`match.tol(x, table, nomatch=NA, tol.type="both", tol=0)`

a vector of the same length of `x`

, indicating the position of the matching observations in `table`

- x
a numerical vector containing seeked values (time-scale of the regular series)

- table
a numerical vector containing initial times to look for match in

`x`

- nomatch
the symbol tu use to flag an entry where no match is found. By default,

`nomatch=NA`

- tol.type
the type of adjustment to use for the time-tolerance:

`"left"`

,`"right"`

,`"both"`

(by default) or`"none"`

. If`tol.type="left"`

, corresponding`x`

values are seeked in a window ]table-tol, table]. If`tol.type="right"`

, they are seeked in the window [table, table+tol[. If`tol.type="both"`

, then they are seeked in the window ]table-tol, table+tol]. If several observations are in this window, the closest one is used. Finally, if`tol.type="none"`

, then the function returns the`nomatch`

symbol for all entries- tol
the tolerance in the time-scale to determine if a value in

`x`

matches a value in`table`

. If`tol=0`

, observations in each respective series must match exactly, otherwise observations in the regulated series are interpolated.`tol`

must be a round fraction of the interval between observations in`x`

(x[i+1] - x[i], (x[i+1] - x[i])/2, (x[i+1] - x[i])/3, etc...), and cannot be larger than it, otherwise,`tol`

is automatically adjusted to the closest allowed value. By default,`tol=NULL`

. This is equivalent to`tol=0`

. Warning!

Philippe Grosjean (phgrosjean@sciviews.org), Frédéric Ibanez (ibanez@obs-vlfr.fr)

`regul`

, `regul.screen`

, `regul.adj`

```
X <- 1:5
Table <- c(1, 3.1, 3.8, 4.4, 5.1, 6)
match.tol(X, Table)
match.tol(X, Table, tol=0.2)
match.tol(X, Table, tol=0.55)
```

Run the code above in your browser using DataLab