Use this function to modify a metadata object, using syntax along the same lines as dplyr::mutate().

stw_mutate_meta(...)

# S3 method for default
stw_mutate_meta(...)

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

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

Arguments

...

Name-value pairs, passed on to stw_mutate_meta()

meta

Object with S3 class stw_meta, contains meta-data

dataset

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

Value

modified copy of meta or dataset

Details

You can send a metadata (stw_meta) object or a dataset (stw_dataset) object, and get back an object of the same class. In other words, if you call this function using a stw_dataset object, it will modify the metadata, then return a modified copy of the stw_dataset object.

Examples

stw_mutate_meta(diamonds_meta, title = "New title")
#> List of 7 #> $ name : chr "diamonds" #> $ title : chr "New title" #> $ description: chr "A dataset containing the prices and other attributes of almost 54,000 diamonds." #> $ sources :List of 2 #> ..$ :List of 3 #> .. ..$ title: chr "DiamondSearchEngine" #> .. ..$ path : chr "http://www.diamondse.info/" #> .. ..$ email: chr "" #> ..$ :List of 3 #> .. ..$ title: chr "ggplot2 package" #> .. ..$ path : chr "https://ggplot2.tidyverse.org/" #> .. ..$ email: chr "" #> $ n_row : int 53940 #> $ n_col : int 10 #> $ dict : tibble [10 × 4] (S3: stw_dict/tbl_df/tbl/data.frame) #> ..$ name : chr [1:10] "price" "carat" "cut" "color" ... #> ..$ type : chr [1:10] "number" "number" "string" "string" ... #> ..$ description: chr [1:10] "price in US dollars ($326--$18,823)" "weight of diamond (0.2--5.01)" "quality of the cut (Fair, Good, Very Good, Premium, Ideal)" "diamond color, from D (best) to J (worst)" ... #> ..$ levels :List of 10 #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : chr [1:5] "Fair" "Good" "Very Good" "Premium" ... #> .. ..$ : chr [1:7] "D" "E" "F" "G" ... #> .. ..$ : chr [1:8] "I1" "SI2" "SI1" "VS2" ... #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> ..- attr(*, "is_valid")= logi TRUE #> - attr(*, "class")= chr "stw_meta" #> - attr(*, "is_valid")= logi TRUE