saveData <- function(data, outputDir = "psymap") {
# Create a unique file name
# fileName <- sprintf("%s_%s.csv", as.integer(Sys.time()), digest::digest(data))
# Write the data to a temporary file locally
filePath <- file.path(tempdir(), "psymap_votes.csv")
write.csv(data, filePath, row.names = FALSE, quote = TRUE)
# Upload the file to Dropbox
drop_upload(filePath, path = outputDir, mode = "overwrite")
}
loadData <- function(outputDir = "psymap") {
# Read all the files into a list
filesInfo <- drop_dir(outputDir)
filePaths <- filesInfo$path_display
data <- lapply(filePaths, drop_read_csv, stringsAsFactors = FALSE)
# Concatenate all data together into one data.frame
data <- do.call(rbind, data)
data
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.