Sitemap

A list of all the posts and pages found on the site. For the robots among you, an XML version is also available.

Pages

A flexible two-column Jekyll theme. Perfect for personal sites, blogs, and portfolios hosted on GitHub or your own server. Latest release v4.9.1

Splash Page

Bacon ipsum dolor sit amet salami ham hock ham, hamburger corned beef short ribs kielbasa biltong t-bone drumstick tri-tip tail sirloin pork chop.

Posts

examples

unit01

Introduction

Setting up R and auxiliary programs for operating R and introducing a few tools if you get stuck.

Summary

You can now use RStudio to write and run a small R script, and find help when a command is unfamiliar.

unit02

Introduction

Learn about different levels of measurement and how information is arranged in data types in R.

Levels of Measurement

The Four Horsemen of Measurement - hear their names: Nominal, Ordinal, Interval, Ratio.

Qualitative Data

The Four Horsemen of Measurement - hear their names: Nominal, Ordinal, Interval, Ratio.

Quantitative Data

Quantitative variables express counts or measured amounts. Their numerical values have a meaning beyond identifying a category: for example, 12 trees are thr...

Summary

You can now describe what a variable means, identify its representation in R, and check a conversion before using the result.

unit03

Summary

You can now choose an R object for a task, inspect its structure, and recognize when combining or converting values changes their type.

unit04

Introduction

You will learn how to use indices to access data in R objects.

Summary

You can now select and replace parts of an object by position, name, or condition, while checking the structure of the result.

unit05

Introduction

You will learn how to set up the working environment

Summary

You can now organize an R project, distinguish objects in memory from files on disk, and use packages deliberately.

unit06

CSV

“Torture the data, and it will confess to anything.” – Ronald Coase

Example: Importing Destatis data

Official data need careful import and interpretation. In this example, you will import recent German land-use statistics, translate the column names, preserv...

Summary

You can now inspect a text file, import it with explicit settings, validate its contents, and choose an appropriate export format.

unit07

Operators

“Data is the new oil.” — Clive Humby

Decisions and loops

Conditional statements choose which code to run based on a logical condition. Loops repeat operations for different values or subsets of data. If-then-else ...

If-then-else

If-then-else statements select which code to run based on a condition. The simplest form is: a <- 5.0 b <- 10.0 if (a < b) { print("a is smaller ...

For loops

For loops repeat a block of code for each element in a sequence. The sequence is evaluated when the loop starts, so its length determines the number of itera...

Writing your own functions

You have already used many functions. Now it is time to write your own. A function can accept one or more arguments, listed in parentheses. Its body, enclose...

The apply family

For loops are a flexible way to repeat tasks. The apply family offers another approach that can make the code shorter and easier to read. Functions in the a...

Loops with lapply

This page develops the examples from the apply family using lapply(). Basic structure The lapply() function is useful for processing data frames. To use it ...

While loops

Like for loops, while loops repeat a block of code. A while loop checks a condition before each iteration and continues while it is TRUE. The number of itera...

Loop and conquer

This worksheet provides practice with conditional statements and loops. Things you need for this worksheet R — the interpreter can be installed on any op...

Summary

You can now combine comparisons, decisions, repetition, and functions into a reusable sequence of operations.

unit08

Introduction

At the end of this unit, you should be able to sort values and reorder rows using an index, combine compatible objects by rows or columns, merge tabl...

Sorting

“It is a capital mistake to theorize before one has data.” — Sherlock Holmes

Binding

“In God we trust, all others bring data.” — W Edwards Deming

Merging

merge() combines data frames by matching values in key columns, regardless of row order. We will use the following two data frames; run the code blocks in or...

Summary

You can now reorder observations, combine tables using an appropriate rule, work with text, and summarize values by group.

Manipulation of character strings

R allows you to manipulate character strings. This is useful. After all, no one is free from mistakes, and typos can creep into your strings. Or maybe you ha...

Aggregate and transform data

Aggregate Aggregation summarizes several observations within each group, for example with sum(), mean(), min(), or max(). The built-in mtcars data includes ...

unit09

Introduction to creating graphs

You will remember from Unit 02 that each type of data requires its own specific techniques for description and visualization. Qualitative data includes non-...

Creating graphs

“No design works unless it embodies ideas that are held common by the people for whom the object is intended.” - Adrian Forty

Dotplot

What is a Dotplot? Short Version: A Cleveland dotchart compares numeric values for named items. Each item has its own row, and the horizontal position of...

Boxplot

What is a Boxplot? A boxplot (also called a box-and-whisker plot) summarises the location and spread of a numeric variable. The box shows the median and t...

Line Chart

What is a Line Chart? A line chart is the graphical representation of the functional relationship of two (with 2D representation) or three (with 3D repr...

Scatterplot

What is a Scatterplot? A scatter plot is a graphical representation of observed pairs of values of two statistical characteristics. These pairs of values ...

Summary

You can now choose a basic plot for a question, label it clearly, and interpret what the display does and does not show.

unit99

Introduction to spotlights

Optional topics that complement the course: Git and GitHub, CSS in R Markdown, and R packages on University of Marburg OPSI PCs.

The many faces of GitHub

An introduction to Git and GitHub, including GitHub Desktop, Git Bash and Git integration in RStudio.

CSS in R Markdown

Learn the basics of HTML and CSS, then use stylesheets and CSS chunks to customise R Markdown HTML output.

R packages on Marburg OPSI PCs

Set up a personal R package library on the H: drive for your University of Marburg account and learn when Windows packages need Rtools.