Use these functions to convert your metadata to roxygen format. The function stw_to_roxygen() returns a roxygen string, stw_use_roxygen() copies a roxygen string to your clipboard, and str_write_roxygen() writes a roxygen string to a file.

stw_to_roxygen(...)

# S3 method for default
stw_to_roxygen(...)

# S3 method for stw_meta
stw_to_roxygen(meta, ...)

# S3 method for stw_dataset
stw_to_roxygen(dataset, ...)

stw_use_roxygen(meta)

stw_write_roxygen(meta, file)

Arguments

...

additional arguments (not used)

meta

Object with S3 class stw_meta, contains meta-data

dataset

Object with S3 class stw_dataset, a data frame with attached meta-data

file

character path of file to write

Value

stw_to_roxygen()

character, roxygen string

stw_use_roxygen()

invisible(meta), called for side-effects

stw_write_roxygen()

invisible(meta), called for side-effects

Examples

cat(stw_to_roxygen(diamonds_meta))
#> #' Prices of 50,000 round cut diamonds #> #' #> #' A dataset containing the prices and other attributes of almost 54,000 diamonds. #> #' #> #' @format A data frame with 53940 rows and 10 variables: #> #' #> #' \describe{ #> #' \item{price}{price in US dollars ($326--$18,823)} #> #' \item{carat}{weight of diamond (0.2--5.01)} #> #' \item{cut}{quality of the cut (Fair, Good, Very Good, Premium, Ideal)} #> #' \item{color}{diamond color, from D (best) to J (worst)} #> #' \item{clarity}{a measurement of how clear the diamond is (I1 (worst), SI2, SI1, VS2, VS1, VVS2, VVS1, IF (best))} #> #' \item{x}{length in mm (0--10.74)} #> #' \item{y}{width in mm (0--58.9)} #> #' \item{z}{depth in mm (0--31.8)} #> #' \item{depth}{total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79)} #> #' \item{table}{width of top of diamond relative to widest point (43--95)} #> #' } #> #' #> #' @source [DiamondSearchEngine](http://www.diamondse.info/): ([email](mailto:)), [ggplot2 package](https://ggplot2.tidyverse.org/): ([email](mailto:)) #> #' #> "diamonds" #>
stw_write_roxygen(diamonds_meta, tempfile(fileext = ".yml"))
#> Roxygen metadata written to '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmphYr5MF/file8fd50dff7b8.yml'.
if (FALSE) { # not run because it copies text to the clipboard stw_use_roxygen(diamonds_meta) }