This R package (Question Metadata Preparation) helps preparing question-metadata for the MDM of the research data center of the dzhw. If you do not work for the research data center of the dzhw, this package will probably be only useful for learning purposes, as it is specifically designed to help with our internal processes.

## Installation for Users

If you are a Windows user you might need to install the Rtools, in case one of the dependencies is not available as a binary. Make sure to use the correct – matching to the version of your R installation – version, not necessarily the newest version.

You can install the released version of questionMetadataPreparation from Github within your R session:

install.packages("remotes", dependencies = TRUE)
remotes::install_github("dzhw/questionMetadataPreparation")

### After updating to a newer R version

In case you update R, first make sure to have the appropriate Rtools version installed. Recently for example, R 4.0.0 was released, so you have to make sure to use rtools40-x86_64.exe. Afterwards, perform the installation process from above again. In case there’s an error that the package/library $X is not available, install this package manually: install.packages("$X", type="source") and replace \$X with the package that caused the error (e.g. backports). It might be required to run update.packages(repos='http://cran.rstudio.com/', ask=FALSE, checkBuilt=TRUE).

# Basic Workflow

Load the library and set the working directory

library(questionMetadataPreparation)
setwd("/yourworkingdirectory")

In order to convert a Zofar export into a format which can be manually edited, you have to run:

convert_zofar_export_to_handcrafted_questionnaire("./questions/ins1")

The output will be written to "./handcrafted/questions".

A set of handcrafted questionnaires can be manually converted into the MDM format by running

convert_handcrafted_questionnaires_to_mdm_format("./questions")

The output will be written to "./mdm/questions".

## Installation of development version

Developers need to setup the R devtools on their machine.

install.packages("devtools", dependencies = TRUE)
devtools::install_github("dzhw/questionMetadataPreparation")

After setting up devtools you can install all required R packages with

R -e 'devtools::install_deps(dep = T)'

You can build the package on you local machine with

R CMD build .

Before pushing to Github (and thus kicking of CI) you should run

R CMD check *tar.gz