Statistics Denmark API using R: Glossary

Key Points

Before we Start
  • Use RStudio to write and run R programs.

  • Use install.packages() to install packages (libraries).

Introduction to R
Starting with Data
  • Use read_csv to read tabular data in R.

  • Use factors to represent categorical data in R.

What is an API?
  • Getting data from an API is equivalent to requesting a webpage

  • POST requests to servers put specific demands on how we request data

What about danstat?
  • R Markdown is a useful language for creating reproducible documents combining text and executable R-code.

Time
  • Use pivot_longer() to go from wide to long format.

Data Visualisation with ggplot2
  • ggplot2 is a flexible and useful tool for creating plots in R.

  • The data set and coordinate system can be defined using the ggplot function.

  • Additional layers, including geoms, are added using the + operator.

  • Boxplots are useful for visualizing the distribution of a continuous variable.

  • Barplots are useful for visualizing categorical data.

  • Faceting allows you to generate multiple plots based on a categorical variable.

Whats next?
  • Practice makes perfect

  • KUB Datalab offers lots of courses and consultations

  • The web is overflowing with tutorials and courses

Glossary

Cheat sheet of functions used in the lessons

Lesson 1 – Introduction to R

Lesson 2 – Starting with Data

Lesson 3 – Data Wrangling with dplyr and tidyr

Lesson 4 – Data Visualization with ggplot2

Lesson 5 – Processing JSON data