Description Usage Arguments Details Value Examples
View source: R/plot_outliers.R
Once you have flagged outliers using any model (randomForest for example), you can plot the outliers that have already been flagged vs the one you have flagged
1 | plot_outliers(data, id)
|
data |
full data frame with at least SNWD, OUTLIER_FINAL, ID, DATE, OUTLIER_PRED |
id |
the id for the station you want to plot |
This will show known outliers as triangles, and points you predict to be outliers as blue. So a blue triangle is a point you marked as an outlier that we also found to be an outlier. A green triangle is a point we found to be and outlier and you did not. A blue circle is a point you flagged as an outlier that we did not. And a green circle is a point neither you nor we flagged.
Note that you must have at least SNWD, OUTLIER_FINAL, ID, DATE, and OUTLIER_PRED in order to use this function. You will need to manually create the OUTLIER_PRED variable
plotly plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
# See the readme for a better example.
# gets the ids of stations which had predicted outliers
flagged_ids <- dplyr::filter(test_data, OUTLIER_PRED == 1) %>%
dplyr::select(ID) %>%
dplyr::distinct()
# plots the first 20 stations
for (i in 1:20) {
print(flagged_ids[i, "ID"])
print(plot_outliers(test_data, as.character(flagged_ids[i,"ID"])))
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.