knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(pttrobo) library(tidyverse)
ennuste_data <- read_ennuste_data( system.file("ennustekuvat", "ptt_ennusteet_KT_2022_1.xlsx", package="pttrobo") ) vuosimuutos <- function(d, groups) { d |> with_groups( .groups = {{ groups }}, mutate, value = 100 * ((value / lag(value, 4, order_by = time)) -1) ) } ## draw_ennuste( ## yaml_path = system.file("ennustekuvat", "MA_kuviot.yaml", package="pttrobo"), ## yaml_kuvion_nimi = "tukin_hinta", ## excel_path = system.file("ennustekuvat", "ptt_ennusteet.xlsx", package = "pttrobo"), ## from_year = 2015 ## )
ptt_data_robo_l("StatFin/kan/ntp/statfin_ntp_pxt_132h.px") |> filter( taloustoimi == "B1GMH Bruttokansantuote markkinahintaan", tiedot == "Kausitasoitetun ja työpäiväkorjatun sarjan volyymin muutos vuodentakaisesta, %", time >= "2010-01-01" ) |> mutate(tiedot = "BKT") |> ptt_plot( grouping = tiedot, title = "BKT Suomi", subtitle = "Vuosimuutos", caption = "Lähde: Tilastokeskus ja PTT", rangeslider = FALSE, ## rangeslider = "2015-01-01", zeroline = T ) |> ptt_plot_add_prediction_traces(ennuste_data, with_labs = T, showlegend = F) ## p ## p |> ptt_plot_create_widget() ## e <- ## readxl::read_excel(ennuste_data_file) |> ## dplyr::filter(stringr::str_detect(filter, "B1GMH|P3KS14")) p <- p |> p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.