gen_ref_id | R Documentation |
This function returns a unique reference id that can be used in scripts and cited in associated plots to help find the associated code on GitHub.
gen_ref_id()
A best practice would be to store the character string output as an object called 'ref_id' in the top matter of your script. If you run 'gophr::get_metadata' after this is stored as an object, it will automatically store this for use in 'metadata$caption'.
8 character string
## Not run:
library(glamr)
library(gophr)
library(ggplot2)
library(glue)
#create a reference id to include in a plot
gen_ref_id()
ref_id <- "1e64716c"
get_metadata()
#plot with ref id
ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
geom_point() +
labs(caption = glue("Source: Edgar Anderson's Iris Data | Ref id: {ref_id}"))
Or
ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
geom_point() +
labs(caption = metadata$caption)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.