deDupe | R Documentation |
Removes duplicated datetime values. Many time series, especially from Environment Canada, may contain duplicated datetimes. This function replaces the duplicated values. It is important to use this function before interpolating or imputing values, and especially before writing the data frame to an obs file.
deDupe(obs, action = "mean", quiet = TRUE, logfile = "")
obs |
Required. A CRHMr data frame containing the obs values. |
action |
Optional. The action used to replace the duplicate values. Must be one of min, max, mean, skip, delete, split or second. Default is mean. |
quiet |
Optional. Suppresses display of messages, except for errors. If you are calling this function
in an R script, you will usually leave |
logfile |
Optional. Name of the file to be used for logging the action. Normally not used. |
If there are no duplicates, returns 'No duplicates'
. If duplicates exist, and are are
successfully removed, the de-duplicated data frame is returned. If the de-duplication is unsuccessful,
then an error is returned.
If action=min, max, or mean, the action function is applied to all of
the values for each duplicate datetime. If action=skip or delete, then the values of
the duplicate datetimes are deleted. If action=split then the original values are kept, and the duplicate values are written to an obs file. The name of the obs file is the name of the obs variable followed by '_dupes.obs'
. If action=second, then the second duplicate values are used. This can be useful when dealing with duplicates caused by daylight savings time.
Kevin Shook
findDupes
BadLake.deduped <- deDupe(BadLake7376, action='mean')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.