#' Convert plot letter codes to numeric values, for math and graphing.
#'
#' @import dplyr
#' @param x the dataframe to be cleaned
#' @return x$PlotCode the corrected vector
#'
#' @export
CodePlots <- function(x){
PlotDistances <- list(A = 4,
B = 14,
C = 24,
D = 34,
E = 44,
F = 54,
G = 64)
x <- x %>%
mutate(PlotCode = x$Plot)
for(i in 1:length(PlotDistances)){
x$PlotCode <- gsub(paste0("\\b", names(PlotDistances)[i], "\\b"), PlotDistances[[i]], x$PlotCode)
}
x$PlotCode <- as.numeric(x$PlotCode)
return(x$PlotCode)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.