#' Load the most recent data from Collector
#'
#' This function allows you to pull most recent data file if date logic used (e.g Collector).
#' @param folder Folder with data files
#' @param prefix Prefix of data files
pull.recent <- function(folder, prefix = "Data_*"){
if(missing(folder)){
try(setwd("~/Downloads"),silent = T)
try(setwd("C:/Users/kitd/Downloads"), silent = T)
}
try(setwd(folder), silent = T)
temp = list.files(pattern=prefix)
if(length(temp) == 1){
df <- read.csv(temp[1])
print(temp[1])
}
if(length(temp) > 1 && length(temp) < 11){
df <- read.csv(temp[length(temp) - 1])
print(temp[length(temp) - 1])}
if(length(temp) > 10){
df <- read.csv(temp[length(temp) - 9])
print(temp[length(temp) - 9])}
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.