Author Archives: norbert

About norbert

Biometrician at Clinical Trial Centre, Leipzig University (GER), with degrees in sociology (MA) and public health (MPH).

How to Check if a Date is Within a List of Intervals in R

Intro I'm currently involved in a research project called EFFECT. EFFECT is a multicentre, cluster-randomised, placebo-controlled cross-over trial evaluating antiseptic body wash of patients on intensive care units (ICU). The trial is to test whether daily antiseptic body wash reduces … Continue reading

Posted in Tips & Tricks | Tagged , , | Leave a comment

Drawing a Fish Curve using R and ggplot2

Intro Recently, I wondered whether there is a way to draw a fish shape using a mathematical function. Since I did not find a ready-made R function, I tried to write the function by myself. The equations, I've used for … Continue reading

Posted in Tips & Tricks, Visualizing Data | Tagged , | Leave a comment

How to order factors by level frequency and level name

Intro Quite frequently, factor variables are ordered by level frequency. However, factor levels having only a few observations are sometimes collapsed into one level usually named “others”. Since this level is usually not of particular interest, it may be a … Continue reading

Posted in Tips & Tricks, Visualizing Data | Tagged | 2 Comments

Postleitzahlen mit führender Null richtig formatieren

Intro Importiert man Postleitzahlen aus anderen Datenformaten (z.B. Excel, Access) in R, ist es nicht selten, dass Postleitzahlen programmintern tatsächlich auch als Zahlen abgespeichert werden. Wie ein Blick auf einen im Internet frei verfügbaren Datensatz zeigt, kann dies zu folgendem … Continue reading

Posted in Tips & Tricks | Tagged , | 2 Comments

Scoring the PHQ-9 Questionnaire Using R

Intro The PHQ-9 is the nine-item depression module of the Patient Health Questionnaire. Each of the items is scored on a 4-point Likert scale ranging from 0 (not at all) to 3 (nearly every day). The items are summed to … Continue reading

Posted in Indroduction | Tagged , | Leave a comment

Sample Size Calculation Using R

Preample “Sample Size Calculation Using R” – the title of this blog post – sounds very comprehensive. However, this post only deals with the sample size collection for one particular test (two sample t-test). A collection of functions for basic … Continue reading

Posted in Indroduction | Tagged , , , | Leave a comment

How to Plot Venn Diagrams Using R, ggplot2 and ggforce

Intro Venn diagrams – named after the English logician and philosopher John Venn – “illustrate the logical relationships between two or more sets of items” with overlapping circles. In this tutorial, I'll show how to plot a three set venn … Continue reading

Posted in Visualizing Data | Tagged , | Leave a comment