dpr_document: Build data documentation

Description Usage Arguments Format Source Examples

View source: R/dpr_document.R

Description

Document data file as a readme or as 'data.R' for use when building to '.Rd' file for an R package.

–desc–

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
dpr_document(
  data_object,
  extension = "md",
  export_folder = "R",
  object_name = "pdat",
  title = "My title of my data",
  description = "Short Description",
  source = "Where the data was found",
  format = "A data frame with columns:",
  var_details = list(day_month = "The numbered day of the month", day_year =
    "The numbered day of the year"),
  append = TRUE,
  details = TRUE
)

Arguments

data_object

is an R data frame.

extension

is a character vector of formats to build. Defaults to "md". Potential extensions are 'md' and 'R'. If both documents are desired then 'mdR' or any combination can be used to get both.

export_folder

is the folder where the data document files will be placed. If the extension is '.R' then the 'export_folder' will have the subdirectory 'R' added.

object_name

is the name of the data object for an R package data set or the name of the file for and md extension.

title

is the title of the data.

description

is a short description of the data. If NULL then not used.

source

is a description of the source of the data.

format

defaults to the text "A data frame with columns:" and is generally the best text to use.

var_details

a list with the column name and the column description.

append

Defaults to TRUE. If TRUE then the new data text for 'data.R' or the 'readme.md' will be appended. If FALSE then the files will be overwritten.

details

If TRUE then information is printed to screen during the process. Default is TRUE.

Format

a text object is returned and a file is writtern to the folder specificed named data.

–format– \describe

Source

\url–source–

Examples

1
2
3
4
5
6
7
dd <- read_csv(system.file("extdata", "Draft_vietnam.csv", package = "DataPushR"))
dd_descriptions <- list(day_month = "Day of the month", day_year = "Day of the year (1-365)", month = "1-12 for the numeric order of months", month_name = "The english name of the month", n69 = "1969 draft order. 1-366", n70 = "1970 draft order. 1-366", n71 = "1969 draft order. 1-366", n72 = "1972 draft order. 1-366")
dpr_document(dd, extension = ".R", export_folder = getwd(), object_name = "dat_draft", title = "Vietnam Draft Numbers", description = "This data can be used to teach correlation.", source = "https://www.randomservices.org/random/data/Draft.html", var_details = dd_descriptions)
dpr_document(dd, extension = ".md", export_folder = getwd(), object_name = "dat_draft", title = "Vietnam Draft Numbers", description = "This data can be used to teach correlation.", source = "https://www.randomservices.org/random/data/Draft.html", var_details = dd_descriptions)
\dontrun{
--data.name--
}

BYUIDSS/DataPushR documentation built on June 1, 2020, 11:58 p.m.