#' save_as_csv
#'
#' Save a data frame as CSV file
#' @param data Data frame to be written into CSV
#' @param filePath File path (directory + name) of the destination CSV file
#' @param ... Additional parameters to be passed into write_csv() function
#' @return File path (directory + name) of the written CSV file
#' @import assertthat
#' @import readr
#' @examples
#' save_as_csv(mydata,"iris.csv")
#' save_as_csv(mydata,"../../iris.csv", append = FALSE)
#' @export
save_as_csv <- function(data, filePath, ...) {
assert_that(is.writeable(dirname(filePath)))
assert_that(has_extension(filePath, "csv"))
write_csv(data, filePath, ...)
return(filePath)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.