library(xaringanthemer) library(sdcLog) library(DiagrammeR) style_mono_accent( base_color = "#1d3557", header_font_google = google_font("Fira Sans"), text_font_google = google_font("Fira Sans", "300", "300i"), code_font_google = google_font("Fira Mono") )
options(htmltools.dir.version = FALSE) options(datatable.print.keys = FALSE) options(datatable.print.class = FALSE) knitr::opts_chunk$set( # prompt = TRUE, # comment = "#>", collapse = TRUE, background = "#FAFAFA" )
Ich arbeite im Forschungsdaten- und Servicezentrum (FDSZ) der Deutschen Bundesbank.
--
Inhaltliche Schwerpunkte:
--
--
--
--
Zwei einfache Regeln:
--
--
Forschende möchten das arithmetische Mittel einer Variable berechnen und das
Ergebnis in ihrer Publikation zeigen.
Dazu müssen sie vorab mit sdc_descriptives()
zeigen, dass das Ergebnis den
Output-Regeln entspricht.
--
.pull-left[
data("sdc_descriptives_DT") DT <- sdc_descriptives_DT head(DT)
]
--
.pull-right[
# gesuchtes Ergebnis DT[, .(mean = mean(val_1, na.rm = TRUE)), by = "sector"]
]
--
# Nachweis, dass das Ergebnis den Regeln entspricht sdc_descriptives(DT, id_var = "id", val_var = "val_1", by = "sector")
Diesmal berechnen die Forschenden das arithmetische Mittel gruppiert nach sector
und year
.
--
sdc_descriptives(DT, id_var = "id", val_var = "val_1", by = c("sector", "year"))
Jetzt möchten Forschende neben dem arithmetischen Mittel auch noch das Minimum und Maximum einer Variablen zeigen.
--
Minimum und Maximum sind vertrauliche Einzeldaten.
--
"Minumum" und "Maximum" als arithmetisches Mittel der kleinsten bzw.
größten Werte mit sdc_min_max()
:
--
sdc_min_max(DT, id_var = "id", val_var = "val_1")
Jetzt möchten Forschende die Ergebnisse einer linearen Regression veröffentlichen.
--
options(sdc.n_ids = 3) # Modell berechnen mod <- lm(val_1 ~ sector + year + val_2, data = DT) # Prüfen, ob Ergebnise freigegeben werden können sdc_model(DT, model = mod, id_var = "id")
grViz(" digraph boxes_and_circles { # a 'graph' statement graph [overlap = true, fontsize = 30] # several 'node' statements node [shape = box, fontname = 'Fira Sans', width = 5.5] script [label = 'analysis.R\nenthält sdc_descriptives() / sdc_min_max() / sdc_model()']; node [width = 1] log [label = 'Log Datei'] node [shape = box, width = 3] checks [label = 'Prüfung durch FDSZ'] node [shape = oval, width = 1] sdc_log [label = '@@1'] # several 'edge' statements script -> sdc_log sdc_log -> log log -> checks } [1]: 'sdc_log(analysis.R)' ")
install.packages("sdcLog")
https://github.com/matthiasgomolka/sdcLog/issues
matthias.gomolka@bundesbank.de
069 9556-4991
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.