R/rds2csv.R

Defines functions rds2csv

Documented in rds2csv

#' Convert RDS file to CSV file
#'
#' Converts an RDS file containing an R dataframe to a CSV.
#'
#' @param file RDS file name including path
#' @return A CSV file in the same folder and with the same name as the RDS file
#' @export
rds2csv <- function(file) {

  data <- readRDS(file)
  outfile <- gsub(".Rds", ".csv", file)
  write.csv(data, file=outfile, row.names = F)

}
cfree14/freeR documentation built on Aug. 22, 2023, 11:12 p.m.