View source: R/addClustering.R
addClustering | R Documentation |
Clustering is used to assign individual measurements to deployment locations.
A temporary monitor will be moved around from time to time, sometimes across the country and sometimes across the street. We need to assign unique identifiers to each new "deployment" but not when the monitor is moved a short distance.
We use clustering to find an appropriate number of unique "deployments". The sensitivity of this algorithm can be adjused with the clusterDiameter argument.
Standard kmeans
clustering does not work well when clusters can have widely
differing numbers of members. A much better result is acheived with
the Partitioning Around Medoids method available in cluster::pam()
.
The value of clusterRadius
is compared with the output of
cluster::pam(...)$clusinfo[,'av_diss']
to determine the number of clusters.
addClustering(
tbl,
clusterDiameter = 1000,
lonVar = "longitude",
latVar = "latitude",
maxClusters = 50,
flagAndKeep = FALSE
)
tbl |
Tibble with geolocation information (e.g. created by
|
clusterDiameter |
Diameter in meters used to determine the number of clusters (see description). |
lonVar |
Name of longitude variable in the incoming tibble. |
latVar |
Name of the latitude variable in the incoming tibble. |
maxClusters |
Maximum number of clusters to try. |
flagAndKeep |
Logical specifying flagging, rather than removal, of bad data during the QC process. |
Input tibble with additional columns: clusterLon, clusterLat
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.