#' Example data-getting function
#'
#' @param url URL from which to get data
#' @param fname Filename to write
#' @param key A key passed to openssl::md5 to create new identifiers
#'
#' @return NULL
#' @export
#' @importFrom openssl md5
#'
#' @examples
#' getData(url = "https://www.dropbox.com/s/pq1oxe0zyedfzcq/testdata.csv",
#' file = "testfile.csv",
#' key = "demokeyvalue")
getData <- function(url, file, key=""){
ifelse(Sys.info()['sysname']== "Windows",
download.file(url, destfile="origfile", method = "wget", extra = "--no-check-certificate"),
download.file(url, destfile="origfile", method = "wget"))
#download.file(url, destfile="origfile", method = "wget")
dataset <- read.csv("origfile", row.names = NULL)
unlink("origfile")
dataset <- mutate(dataset, newcodes = md5(as.character(originalID), key = key)) %>%
select(-originalID)
write.csv(dataset, file = gsub(":", "-", file))
return(dataset)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.