#' Check Sample Numbers for Grade
#'
#' Ensure that each sample number has only one grade of fish in it.
#'
#' @template Pdata
#'
#' @author Kelli F. Johnson
#' @return todo: document what checkGrade returns.
#'
checkGrade <- function(Pdata) {
out <- tapply(Pdata$GRADE, Pdata$SAMPLE_NO,
function(x) length(unique(x)) == 1)
ifelse(all(out == 1), "One grade per sample number.",
"More than one grade per sample number.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.