#' Function for sampling, taken from stackoverflow
#'
#' @param df the df to sample from
#' @param size number of samples
#'
#' @export
#'
#' @examples
#' Will sample 2 observations per species in the iris dataframe
#' iris.sample<-ddply(iris,.(Species),function(df) sampleGroup(df,2))
sampleGroup<-function(df,size) {
df[sample(nrow(df),size=size),]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.