write_pkg_data: Create a CSV variant of .rda files

View source: R/write_pkg_data.R

write_pkg_dataR Documentation

Create a CSV variant of .rda files

Description

The function should be run with a path to a package directory. It will then look through the data directory of the package, and for all datasets that are data frames, create CSV variants in a data-csv directory.

Usage

write_pkg_data(
  pkg,
  dir = paste0("data-", out_type),
  overwrite = FALSE,
  out_type = c("csv", "tab", "R")
)

Arguments

pkg

The R package where we'd like to generate CSVs of any data frames.

dir

A character string representing the path to the folder. where the CSV files should be written. If no such directory exists, one will be created (recursively).

overwrite

Boolean to indicate if to overwrite any existing files that have conflicting names in the directory specified.

out_type

Format for the type of output as a CSV ("csv"), tab-delimited text file ("tab"), or the R code to generate the object ("R").

Examples

## Not run: 
write_pkg_data("openintro")
list.files("data-csv")

## End(Not run)

openintro documentation built on June 22, 2024, 7:37 p.m.