Title: | 'rmarkdown' Extension for Formatted 'RJDemetra' Outputs |
---|---|
Description: | Functions to have nice 'rmarkdown' outputs of the seasonal and trading day adjustment models made with 'RJDemetra'. |
Authors: | Alain Quartier-la-Tente [aut, cre] |
Maintainer: | Alain Quartier-la-Tente <[email protected]> |
License: | EUPL |
Version: | 0.2.3 |
Built: | 2024-11-16 05:36:20 UTC |
Source: | https://github.com/AQLT/rjdmarkdown |
Function to create a 'rmarkdown' file with all the output and render it
create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'SA' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'jSA' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'workspace' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'multiprocessing' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ..., workspace ) ## S3 method for class 'sa_item' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ..., workspace )
create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'SA' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'jSA' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'workspace' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ... ) ## S3 method for class 'multiprocessing' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ..., workspace ) ## S3 method for class 'sa_item' create_rmd( x, output_file, output_format = "pdf_document", preprocessing_fun = print_preprocessing, decomposition_fun = print_decomposition, diagnostics_fun = print_diagnostics, title = "Seasonal adjustment summary", knitr_chunk_opts = list(fig.pos = "h", echo = FALSE, results = "asis", fig.cap = "S-I Ratio"), ..., workspace )
x |
the object to render: it can be a |
output_file |
the name of the output 'rmarkdown' file. |
output_format |
the R Markdown output format to convert to: |
preprocessing_fun |
the function used to print the preprocessing.
print_preprocessing by default.
If |
decomposition_fun |
the function used to print the decomposition
print_decomposition by default.
If |
diagnostics_fun |
the function used to print the diagnostics
print_diagnostics by default.
If |
title |
the title of the R Markdown document. |
knitr_chunk_opts |
options for R code chunks. See opts_chunk for more details. |
... |
other arguments to pass to render. |
workspace |
the workspace. Only used when |
ipi <- RJDemetra::ipi_c_eu[, "FR"] jsa_x13 <- RJDemetra::jx13(ipi) output_file <- tempfile(fileext = ".Rmd") create_rmd(jsa_x13, output_file, output_format = "pdf_document") # To directly open the pdf: browseURL(sub(".Rmd",".pdf", output_file, fixed = TRUE)) # To create a pdf from a workspace: jsa_ts <- jtramoseats(ipi) wk <- new_workspace() mp <- new_multiprocessing(wk, "sa1") add_sa_item(wk, "sa1", jsa_x13, "X13") add_sa_item(wk, "sa1", jsa_ts, "TramoSeats") # It's important to compute the workspace to be able # to import the models compute(wk) output_file <- tempfile(fileext = ".Rmd") create_rmd(wk, output_file, output_format = c("pdf_document", "html_document"), output_options = list(toc = TRUE, number_sections = TRUE)) # To open the file: browseURL(sub(".Rmd",".pdf", output_file, fixed = TRUE)) browseURL(sub(".Rmd",".html", output_file, fixed = TRUE))
ipi <- RJDemetra::ipi_c_eu[, "FR"] jsa_x13 <- RJDemetra::jx13(ipi) output_file <- tempfile(fileext = ".Rmd") create_rmd(jsa_x13, output_file, output_format = "pdf_document") # To directly open the pdf: browseURL(sub(".Rmd",".pdf", output_file, fixed = TRUE)) # To create a pdf from a workspace: jsa_ts <- jtramoseats(ipi) wk <- new_workspace() mp <- new_multiprocessing(wk, "sa1") add_sa_item(wk, "sa1", jsa_x13, "X13") add_sa_item(wk, "sa1", jsa_ts, "TramoSeats") # It's important to compute the workspace to be able # to import the models compute(wk) output_file <- tempfile(fileext = ".Rmd") create_rmd(wk, output_file, output_format = c("pdf_document", "html_document"), output_options = list(toc = TRUE, number_sections = TRUE)) # To open the file: browseURL(sub(".Rmd",".pdf", output_file, fixed = TRUE)) browseURL(sub(".Rmd",".html", output_file, fixed = TRUE))
Function to print the decomposition model
print_decomposition( x, format = knitr::opts_knit$get("rmarkdown.pandoc.to"), plot = TRUE, digits = 3, decimal.mark = getOption("OutDec"), booktabs = TRUE, ... )
print_decomposition( x, format = knitr::opts_knit$get("rmarkdown.pandoc.to"), plot = TRUE, digits = 3, decimal.mark = getOption("OutDec"), booktabs = TRUE, ... )
x |
the object to print. |
format |
output format: |
plot |
boolean indicating whether to plot or not the S-I Ratio. |
digits |
number of digits after the decimal point. |
decimal.mark |
the character to be used to indicate the numeric decimal point. |
booktabs |
boolean indicating whether to use or not the booktabs package (when |
... |
arguments passed to |
ipi <- RJDemetra::ipi_c_eu[, "FR"] jsa_x13 <- RJDemetra::jx13(ipi) print_decomposition(jsa_x13, format = "latex") sa_ts <- RJDemetra::jtramoseats(ipi) print_decomposition(sa_ts, format = "html")
ipi <- RJDemetra::ipi_c_eu[, "FR"] jsa_x13 <- RJDemetra::jx13(ipi) print_decomposition(jsa_x13, format = "latex") sa_ts <- RJDemetra::jtramoseats(ipi) print_decomposition(sa_ts, format = "html")
Function to print diagnostics tests on the quality of the pre-processing and the decomposition
print_diagnostics( x, format = knitr::opts_knit$get("rmarkdown.pandoc.to"), signif.stars = TRUE, tests = c("mean", "skewness", "kurtosis", "ljung box", "ljung box (residuals at seasonal lags)", "ljung box (squared residuals)", "qs test on sa", "qs test on i", "f-test on sa (seasonal dummies)", "f-test on i (seasonal dummies)", "Residual seasonality (entire series)", "Residual seasonality (last 3 years)", "f-test on sa (td)", "f-test on i (td)"), digits = 3, decimal.mark = getOption("OutDec"), booktabs = TRUE, ... )
print_diagnostics( x, format = knitr::opts_knit$get("rmarkdown.pandoc.to"), signif.stars = TRUE, tests = c("mean", "skewness", "kurtosis", "ljung box", "ljung box (residuals at seasonal lags)", "ljung box (squared residuals)", "qs test on sa", "qs test on i", "f-test on sa (seasonal dummies)", "f-test on i (seasonal dummies)", "Residual seasonality (entire series)", "Residual seasonality (last 3 years)", "f-test on sa (td)", "f-test on i (td)"), digits = 3, decimal.mark = getOption("OutDec"), booktabs = TRUE, ... )
x |
the object to print. |
format |
output format: |
signif.stars |
logical; if |
tests |
characters containing the names of the tests to print. |
digits |
number of digits after the decimal point. |
decimal.mark |
the character to be used to indicate the numeric decimal point. |
booktabs |
boolean indicating whether to use or not the booktabs package (when |
... |
unused arguments. |
ipi <- RJDemetra::ipi_c_eu[, "FR"] jsa_x13 <- RJDemetra::jx13(ipi) print_diagnostics(jsa_x13, format = "latex") sa_ts <- RJDemetra::tramoseats(ipi) print_diagnostics(sa_ts, format = "html")
ipi <- RJDemetra::ipi_c_eu[, "FR"] jsa_x13 <- RJDemetra::jx13(ipi) print_diagnostics(jsa_x13, format = "latex") sa_ts <- RJDemetra::tramoseats(ipi) print_diagnostics(sa_ts, format = "html")
Function to print the pre-processing model
print_preprocessing( x, format = knitr::opts_knit$get("rmarkdown.pandoc.to"), signif.stars = TRUE, digits = 3, decimal.mark = getOption("OutDec"), booktabs = TRUE, summary = TRUE, likelihood = TRUE, arima = TRUE, regression = TRUE, ... )
print_preprocessing( x, format = knitr::opts_knit$get("rmarkdown.pandoc.to"), signif.stars = TRUE, digits = 3, decimal.mark = getOption("OutDec"), booktabs = TRUE, summary = TRUE, likelihood = TRUE, arima = TRUE, regression = TRUE, ... )
x |
the object to print. |
format |
output format: |
signif.stars |
logical; if |
digits |
number of digits after the decimal point. |
decimal.mark |
the character to be used to indicate the numeric decimal point. |
booktabs |
boolean indicating whether to use or not the booktabs package (when |
summary |
boolean indicating whether to use or not the summary section. |
likelihood |
boolean indicating whether to use or not the likelihood section. |
arima |
boolean indicating whether to use or not the arima section. |
regression |
boolean indicating whether to use or not the regression section. |
... |
unused. |
ipi <- RJDemetra::ipi_c_eu[, "FR"] sa_x13 <- RJDemetra::jx13(ipi) print_preprocessing(sa_x13, format = "latex") sa_ts <- RJDemetra::tramoseats(ipi) print_preprocessing(sa_ts, format = "html")
ipi <- RJDemetra::ipi_c_eu[, "FR"] sa_x13 <- RJDemetra::jx13(ipi) print_preprocessing(sa_x13, format = "latex") sa_ts <- RJDemetra::tramoseats(ipi) print_preprocessing(sa_ts, format = "html")