Use these functions to convert your metadata to YAML format. The function
stw_to_yaml()
returns a YAML string, stw_use_yaml()
copies a YAML string
to your clipboard, and str_write_yaml()
writes a YAML string to a file.
stw_to_yaml(meta, ...) # S3 method for default stw_to_yaml(meta, ...) # S3 method for stw_meta stw_to_yaml(meta, ...) stw_use_yaml(meta) stw_write_yaml(meta, file)
meta | Object with S3 class |
---|---|
... | additional arguments (not used) |
file |
|
stw_to_yaml()
character
, YAML string
stw_use_yaml()
invisible(meta)
, called for side-effects
stw_write_yaml()
invisible(meta)
, called for side-effects
#> name: diamonds #> title: Prices of 50,000 round cut diamonds #> description: A dataset containing the prices and other attributes of almost 54,000 #> diamonds. #> sources: #> - title: DiamondSearchEngine #> path: http://www.diamondse.info/ #> email: '' #> - title: ggplot2 package #> path: https://ggplot2.tidyverse.org/ #> email: '' #> schema: #> fields: #> - name: price #> type: number #> description: price in US dollars ($326--$18,823) #> - name: carat #> type: number #> description: weight of diamond (0.2--5.01) #> - name: cut #> type: string #> description: quality of the cut (Fair, Good, Very Good, Premium, Ideal) #> constraints: #> enum: #> - Fair #> - Good #> - Very Good #> - Premium #> - Ideal #> - name: color #> type: string #> description: diamond color, from D (best) to J (worst) #> constraints: #> enum: #> - D #> - E #> - F #> - G #> - H #> - I #> - J #> - name: clarity #> type: string #> description: a measurement of how clear the diamond is (I1 (worst), SI2, SI1, #> VS2, VS1, VVS2, VVS1, IF (best)) #> constraints: #> enum: #> - I1 #> - SI2 #> - SI1 #> - VS2 #> - VS1 #> - VVS2 #> - VVS1 #> - IF #> - name: x #> type: number #> description: length in mm (0--10.74) #> - name: 'y' #> type: number #> description: width in mm (0--58.9) #> - name: z #> type: number #> description: depth in mm (0--31.8) #> - name: depth #> type: number #> description: total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79) #> - name: table #> type: number #> description: width of top of diamond relative to widest point (43--95)#>if (FALSE) { # not run because it copies text to the clipboard stw_use_yaml(diamonds_meta) }