View source: R/data_source_caption.R
data_source_caption | R Documentation |
Citation information is retrieved from data attributes and used to create a data source caption.
data_source_caption(
data,
citation = NULL,
text = "Data source:",
author = TRUE
)
data |
a data |
citation |
an alternative citation object |
text |
a text to precide a citation. |
author |
A locigal whether to include an author. |
pttdatahaku::ptt_read_data("tyonv_1001", "KOKO MAA") %>%
dplyr::filter(tiedot_code == "AVPAIKAT") %>%
{ ggplot(., aes(x = time, y = values)) +
geom_line() +
geom_smooth() +
labs(x = NULL,
y = attributes(.)$codes_names$tiedot["AVPAIKAT"]) +
data_source_caption(.)
}
pttdatahaku::ptt_read_data("tyonv_1001", "KOKO MAA") %>%
dplyr::filter(tiedot_code == "AVPAIKAT") %>%
{ ggplot(., aes(x = time, y = values)) +
geom_line() +
geom_smooth() +
labs(x = NULL,
y = attributes(.)$codes_names$tiedot["AVPAIKAT"]) +
data_source_caption(., author = FALSE, text = "Tilastolähde")
}
data <- pttdatahaku::ptt_read_data("tyonv_1001", "KOKO MAA")
cit <- attributes(data)$citation
data %>%
dplyr::filter(tiedot_code == "AVPAIKAT") %>%
{ ggplot(., aes(x = time, y = values)) +
geom_line() +
geom_smooth() +
labs(x = NULL,
y = attributes(.)$codes_names$tiedot["AVPAIKAT"]) +
data_source_caption(., author = FALSE, citation = cit, text = "Tilastolähde: Tilastokeskus")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.