Commit dd69c7c1 authored by Knut Wenzig's avatar Knut Wenzig
Browse files

erlaube template.id auch bei variablen, lösche alte titelei

parent 44977905
......@@ -67,16 +67,32 @@ library(dortools)
#codebookcsvpath <- "D:/lokal/isdatadoku/datasets/inno/"
#codebookcsvpath <- "D:/lokal/isdatadoku/datasets/idrm_esm/"
codebookcsvpath <- paste0("D:/lokal/isdatadoku/datasets/",dataset.name,"/")
distribution <- "2015"
# language <- "de"
codebookcsvpath <- "D:/lokal/core-doku/datasets/bgp/"
codebookcsvpath <- "D:/lokal/core-doku/datasets/bglela/"
codebookcsvpath <- "D:/lokal/core-doku/datasets/jugendl/"
codebookcsvpath <- "D:/lokal/isdatadoku/datasets/bioparen/"
codebookcsvpath <- "D:/lokal/isdatadoku/datasets/pgen/"
codebookcsvpath <- "D:/lokal/core-doku/datasets/jugendl/"
codebookcsvpath <- "D:/lokal/piaac-l-2015-2016/Metadata/datasets/ZA5989_Calendar_M/"
codebookcsvpath <- "D:/lokal/piaac-l-2015-2016/Metadata/datasets/ZA5989_Household_16_M/"
codebookcsvpath <- "D:/lokal/piaac-l-2015-2016/Metadata/datasets/ZA5989_Registry_M/"
codebookcsvpath <- "D:/lokal/piaac-l-2015-2016/Metadata/datasets/ZA5989_Cognit_M/"
codebookcsvpath <- "D:/lokal/piaac-l-2015-2016/Metadata/datasets/ZA5989_Persons_16_M/"
codebookcsvpath <- "D:/lokal/soep-bus/datasets/Daten_Bus-Szenarien_September-2017/"
codebookcsvpath <- "D:/lokal/core-doku/datasets/ppfad/"
distribution <- "v33"
language <- lang
language <- "en"
language <- "de"
allow.markdown <- TRUE
collapse.variable.groups <- TRUE
calc.abs.frequencies <- TRUE # TRUE: show only all value labels without frequencies
omit.unlabeled.values <- TRUE # if only_labeled_vals==1
optimize.tables <- TRUE
restrict.questions <- TRUE # Anzeige der Fragen begrenzen (unique Fragen im letzten Jahr)
restrict.questions <- FALSE # Anzeige der Fragen begrenzen (unique Fragen im letzten Jahr)
display.question.id <- TRUE
do.xelatex <- TRUE # LaTeX-Lauf starten
......@@ -103,10 +119,16 @@ datapath <- "//hume/soep-data/DATA2/SOEP-IS/SOEP-IS 2014 Generierung HiWi/Data/f
datapath <- paste0("//hume/soep-data/DATA2/SOEP-IS/SOEP-IS_2014.1_release/download/soep-is.2014.1_stata_",
language,"/")
datapath <- "//hume/soep-data/DATA/soep32_en/stata/"
datapath <- "//hume/soep-data/DATA/soep32_de_l/stata/"
datapath <- "//hume/abt/abt-sop/MA/jnapieraj/piaac/"
datapath <- "//hume/rdc-gen/consolidated/soep-core/soep.v33/consolidated1/"
datapath <- "//hume/soep-data/DATA/soep32_de_l/stata/"
datapath <- paste0("//hume/soep-data/DATA2/SOEP-IS/SOEP-IS 2015 Generierung HiWi/Data/finaldata/",
toupper(language), "/")
datapath <- "//hume/abt/abt-sop/MA/kwenzig/PE PIAAC-L/"
datapath <- "//hume/soep-data/MA/afranken/austausch/"
datapath <- "//hume/abt/abt-sop/MA/mschmaelzle/Datensaetze/"
datapath <- "D:/temp/"
datapath <- "//hume/rdc-gen/consolidated/soep-core/soep.v33/consolidated8/"
# Ordner des repositories (enthaelt Ordner LaTex und R)
path <- "D:/lokal/codebooker/"
......@@ -356,7 +378,8 @@ quest2var <- merge(variables.csv[variables.csv$study==study &
by.y=c("output_study", "output_dataset",
"output_version", "output_variable"),
all=FALSE)
# templated.id umbenennen in v.template.id
names(quest2var)[which(names(quest2var)=="template.id")] <- "v.template.id"
# question und item von logical_variables ranmergen
quest2var <- merge(quest2var, logical_variables.csv[, c("study", "dataset", "variable", "questionnaire", "question", "item")],
by.x=c("input_study", "input_dataset", "input_variable"),
......@@ -424,59 +447,6 @@ if(language=="de"){
codebook.csv <- SwitchLanguageDE(codebook.csv, "label")
}
TitleLaTeX <- function(study, distribution, dataset, version, language) {
# Für den Datensatz dataset wird ein LaTeX-Code für die Titelseite des
# Codebooks erstellt.
#
# Args:
# dataset: ein String (Name des Datensatzes)
#
# Returns:
# LaTeX-Snippet zur Generierung des Titels
title.row <- min(which((titles.csv$study==study & titles.csv$distribution==distribution &
titles.csv$dataset==dataset.name & titles.csv$version==version) ==
TRUE))
title <- titles.csv$Title[title.row]
series <- TeXifyStr(titles.csv$Series[title.row])
seriesno <- TeXifyStr(titles.csv$No[title.row])
if(nchar(seriesno)>0){
seriesno <- paste0("SOEP Survey Paper ", seriesno)
}
date <- TeXifyStr(titles.csv$Erscheinungsjahr[title.row])
author <- titles.csv$Autor[title.row]
publishers <- TeXifyStr(titles.csv$publishers[title.row])
doi <- titles.csv$zuDOI[title.row]
bottomline <- ""
if(nchar(doi)>0){
bottomline <- paste0("This file is part of a collection, which is released with doi:",
doi, ".\n")
}
studies.csv <- read.csv(paste0(meta.path,"studies.csv"),
colClasses="character", encoding="UTF-8")
studies.csv <- studies.csv[studies.csv$study==study, ]
study.label <- studies.csv$label[1]
if(is.null(study.label)){
study.label <- ""
}
topleft <- paste0(study.label, " ", distribution)
title.latex <- ""
title.latex <- TitlePageLaTeX(language=language, topleft=topleft, topright=dataset,
title=title, subtitle="", author=author, date=date,
bottomline=bottomline, abstract="", study=study, objectid=dataset,
with.footer, running.title.only, first.page.number)
if(language=="en"){
title.latex2 <- paste0(title.latex,
"\\resetdefaultlanguage{english}\n")
}
#title.latex2 <- paste0(title.latex, paste0("\\ihead{", title, "}\n",
# "\\ifoot{", seriesno, "}\n",
# "\\title{", title, thanks.latex, "}\n",
# "\\date{", date, "}\n",
# "\\author{", author, "}\n",
# "\\publishers{", publishers, "}\n",
# "\\maketitle\n"))
return(title.latex)
}
VarQuestionsLaTeX <- function(variable) {
# Für die Fragen, die zu den variablen gehören wird LaTeX-Code erzeugt
......@@ -492,7 +462,7 @@ VarQuestionsLaTeX <- function(variable) {
q.tab <- merge(codebook.csv[codebook.csv$variable==variable,
c("study", "dataset", "version",
"variable")],
quest2var[, c("study", "dataset", "version",
quest2var[, c("study","dataset", "version",
"variable", "roottext",
"roottext_de", "text", "text_de",
"input_study", "questionnaire",
......@@ -501,7 +471,8 @@ VarQuestionsLaTeX <- function(variable) {
all=FALSE)
if(nrow(q.tab)>0) {
q.tab <- merge(q.tab, questionnaires.csv[,c("study", "questionnaire", "period")],
by = c("study", "questionnaire"),
by.x = c("input_study", "questionnaire"),
by.y = c("study", "questionnaire"),
all.x = TRUE, all.y = FALSE)
# anzuzeigende Fragen sortieren
q.tab <- q.tab[order(q.tab$period, q.tab$questionnaire, q.tab$sort), ]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment