View source: R/CENTROIDS-pam.R

pam_cent | R Documentation |

Extract the medoid time series based on a distance measure.

```
pam_cent(
series,
distance,
ids = seq_along(series),
distmat = NULL,
...,
error.check = TRUE
)
```

`series` |
The time series in one of the formats accepted by |

`distance` |
A character indicating which distance to use. Only needed if |

`ids` |
Integer vector indicating which of the |

`distmat` |
Optionally, a pre-computed cross-distance matrix of |

`...` |
Any extra parameters for the |

`error.check` |
Logical indicating whether the function should try to detect inconsistencies and give more informative errors messages. Also used internally to avoid repeating checks. |

The medoid's index is determined by taking the `arg min`

of the `distmat`

's row-sums
(considering only the rows in `ids`

). The distance matrix is calculated if needed.

The medoid time series.

```
# Computes the distance matrix for all series
pam_cent(CharTraj, "dtw_basic", ids = 6L:10L, window.size = 15L) # series_id = 7L
# Computes the distance matrix for the chosen subset only
pam_cent(CharTraj[6L:10L], "dtw_basic", window.size = 15L) # series_id = 2L
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.