Skip to content

Import, primary coding and export functions for NAPKON data

License

Notifications You must be signed in to change notification settings

mrainers/epicodr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

epicodr

Import, primary coding and export functions for data of the National Pandemic Cohort Network NAPKON.

💾 Versions & Download

The latest versions of epicodr can be found here: Releases

🔨 How to use this package

Using this package, you can import SÜP, HAP and POP data exported from SecuTrial by the Transfer-Office, set variable and value labels, format date variables, perform primary coding, as well as export the data, e.g. in SPSS format.

Tutorial

You can find a tutorial on how to use this package on YouTube at NUKLEUS ECU.

Step-by-Step Guide

  1. Install a R runtime environment and git on your computer. Provide Internet access.
  2. Create a R file and put the following code inside:
# Install package remotes
if(!require(remotes)) install.packages("remotes")

# Install package epicodr
# replace "release" with a specific version, if necessary
# See section *Versions* for more details
remotes::install_github("nukleus-ecu/epicodr@*release")

# Load package epicodr
library(epicodr)

# Specifiy location where to find data zip file
zip_file_path <- "data/import/NAME_OF_EXPORT_FILE.zip"

# Import the zip file data
data <- zip_file_path %>% 
  read_tsExport(separator = ";", decimal = ",")

# Execute primary coding on data
data_primary_coded <- data %>% 
  # place coding function accordingly, e.g., primary_coding_suep() or primary_coding_hap() or primary_coding_pop()
  primary_coding_suep()

# Note: SPSS only supports levels of variables with <= 120 characters
# Set affected variables to NULL
# e.g.
data_primary_coded$fuv3$disab_ecog.factor <- NULL

# Export the prepared data in R to formats of other statistical software e.g. SPSS (sav) to export folder
# For other formats replace "sav" with (one of "dta", "sas", "sav", "xpt")
write_tsExport(data_primary_coded, format = "sav", path = "data/export/", metadata = TRUE)
  1. Run the script.
  2. Data is exported to folder data/export.

Alternative: Clone this Repository

  1. Install a R runtime environment and git on your computer. Provide Internet access.
  2. Clone this repository: git clone https://github.com/nukleus-ecu/epicodr.git
  3. Export data from secuTrial and place the *.zip file in data/import/.
  4. Open and run script R/run/sample.R for sample import, primary coding and SPSS export or create a new R script by yourself.
  5. Data is exported to folder data/export.

✏️ Supported data structure

Descriptions of the primary codings of the NAPKON cohort platforms SÜP, POP and HAP are available at the following link:

https://cloud.napkon.de/s/kgSLW7gkBExBYfC?path=%2FPrim%C3%A4rkodierung%20Datenauswertung%20_%20Primary%20coding%20Data%20analysis

Additionally, there are manuals that include variable categorizations, aids for calculating scores, defining normal ranges of laboratory parameters and clinical parameters. Further explanations are also available in the tutorial presentation.

Repository structure

This repository is structured as follows:

  • R contains all R code
  • data/import is the place to put raw datasets, i.e. secuTrial exports
  • data/export is the place where exported datasets are stored
  • doc contains further documentation
  • lib contains external libraries
  • resources contains static content such as images
  • tests contains unit tests

💻 R code structure

The R code is structured as follows:

  • R/*.R contains platform independent implementations:
  • R/hap contains HAP specific implementations
  • R/pop contains POP specific implementations
  • R/suep contains SÜP specific implementations

SÜP

Inside R/suep, the code is structured as follows:

  • run contains all run scripts, e.g. to code and export to SPSS format
  • 30-primary-coding.R implements the primary coding of suep
  • XX-export.R contains export functions, e.g. in SPSS format

HAP

Inside R/hap, the code is structured as follows:

  • run contains all run scripts, e.g. to code and export to SPSS format
  • 30-primary-coding.R implements the primary coding of hap
  • XX-export.R contains export functions, e.g. in SPSS format

POP

Inside R/pop, the code is structured as follows:

  • run contains all run scripts, e.g. to code and export to SPSS format
  • 30-primary-coding.R implements the primary coding of hap
  • XX-export.R contains export functions, e.g. in SPSS format

About

Import, primary coding and export functions for NAPKON data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 100.0%