#####
FindBioDensityOutliers <- function(data, frame.depth=0.78, outlier.cutoff = 0.1,
save=FALSE) {
stopifnot(
is.data.frame(data),
date %in% colnames(data)
)
# Fix the date
data$date <- as.character(data$date)
data$date <- as.Date(data$date, format="%m/%d/%Y")
outlier.data <- CalculateBioDensity(data=data, frame.depth=frame.depth)
message("Generating plot of outlier location, by date:")
print(plot(
x=outlier.data$date[which(outlier.data$biodensity > outlier.cutoff)],
y=outlier.data$biodensity[which(outlier.data$biodensity > outlier.cutoff)]
))
message("Proportion of data above cutoff:")
print(
length(test.data$biodensity[which(test.data$biodensity > 0.1)]) / nrow(test.data) * 100
)
if (save == TRUE) {
write.csv(x=outlier.data, file=paste(deparse(substitute(outlier.data)),".csv",sep=""))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.