#' A Function to remove outliers
#'
#' Remove outliers who perform below cutoff without needing to have aggregate data
#' @param id.var The id/grouping variable
#' @param score.var The score
#' @param cutoff # The cutoff value
#' @param df The data frame
outliers <- function(id.var, score.var, cutoff, df){
dataframe <- aggregate(df[,score.var] ~ df[,id.var], df, sum)
colnames(dataframe) <- c(id.var, score.var)
dataframe <- dataframe[dataframe[,score.var] > cutoff,]
df <- df[df[,id.var] %in% dataframe[,id.var],]
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.