R/export_data.r

Defines functions export_data_bt export_data

Documented in export_data export_data_bt

#' Export dataset to a text file
#'
#' @description This function exports a data frame to a tab-delimited text file.
#'
#' @param data A data frame
#' @param file Output file directory
#'
#' @return This function outputs a tab-delimited text file containing the
#'   dataset.
#'
#' @author Kevin Surya
#'
#' @importFrom utils write.table
#'
#' @export
#'
export_data <- function(data, file) {
  write.table(
    x = data,
    file = file,
    quote = FALSE,
    sep = "\t",
    row.names = TRUE,
    col.names = TRUE
  )
}

#' Export dataset to a text file
#'
#' @description This function exports a data frame to a tab-delimited text
#'   file (BayesTraits style).
#'
#' @param data A data frame
#' @param file Output file directory
#'
#' @return This function outputs a tab-delimited text file containing the
#'   dataset.
#'
#' @author Kevin Surya
#'
#' @importFrom utils write.table
#'
#' @export
#'
export_data_bt <- function(data, file) {
  write.table(
    x = data,
    file = file,
    quote = FALSE,
    sep = "\t",
    row.names = TRUE,
    col.names = FALSE
  )
}
suryakevin/drugcandy documentation built on May 6, 2022, 6:37 p.m.