aplot_lines | R Documentation |
Basic PTT line plot
aplot_lines(
dat,
x = time,
y = value,
colour = tiedot,
size = NULL,
y2,
title = "",
subtitle = "",
source = NULL,
caption = "",
rangeslider = FALSE,
...
)
aplot_trends(
dat,
x = time,
y = value,
colour = tiedot,
size = NULL,
title = "",
subtitle = "",
source = NULL,
caption = "",
rangeslider = FALSE,
org_showlegend = FALSE,
trends_only = FALSE,
...
)
dat |
A data.frame to plot. |
x |
y Variables for x- and y-axis. |
colour |
A variable for colours |
size |
A variable for size. Not in use |
y2 |
An optional y-variable for narrow line (forexample original in a trend plot). |
title |
A plot title |
subtitle |
A plot subtitle, use also for y-axis label. |
source |
A source information for caption. Text is added to "Lähde: ..., PTT". |
caption |
A caption text. Will override source |
rangeslider |
A locigal for rangeslider |
... |
Additional arguments for ptt_plot. |
org_showlegend |
A logical to show legend for original data. |
trends_only |
A logical to have only trends in plot. |
aplot_trends()
: Estimate and plot trend with original
library(pttdatahaku)
library(tidyverse)
ptt_data_robo_l("StatFin/vtp/statfin_vtp_pxt_11sf.px") |>
dplyr::filter(
taloustoimi %in% c("P7R Tavaroiden ja palvelujen tuonti, tulona",
"P6K Tavaroiden ja palvelujen vienti, menona"),
tiedot == c("Volyymin muutokset, %")) |>
aplot_lines(colour = taloustoimi,
title = "Vienti ja tuonti",
subtititle = "%, volyymin muutos",
source = "Tilastokeskus")
ptt_data_robo("StatFin/ttvi/statfin_ttvi_pxt_13bh.px") |>
filter_recode(toimiala_tol_2008 = c("BCD Koko teollisuus", "19-22 Kemianteollisuus"),
tiedot = c(indeksi = "Työpäiväkorjattu indeksisarja", trendi = "Trendisarja")) |>
group_by(toimiala_tol_2008, tiedot) |>
mutate(value = 100 * (value / lag(value, 12) -1)) |>
ungroup() |>
spread(tiedot, value) |>
filter(time >= "2018-01-01") |>
aplot_lines(colour = toimiala_tol_2008, y = trendi, y2 = indeksi,
title = "Teollisuustuotannon volyymi",
subtitle = "%-muutos, trendi ja työpäiväkorjattu")
ptt_data_robo_l("StatFin/ntp/statfin_ntp_pxt_132h.px") |>
dplyr::filter(
taloustoimi %in% c("P7R Tavaroiden ja palvelujen tuonti, tulona",
"P6K Tavaroiden ja palvelujen vienti, menona"),
tiedot == c("Alkuperäinen sarja, viitevuosi 2015, miljoonaa euroa")) |>
aplot_trends(colour = taloustoimi,
title = "Vienti ja tuonti",
subtititle = "%, volyymin muutos",
source = "Tilastokeskus")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.