In this vignette, you can see what a codebook generated from a dataset with rich metadata looks like. This dataset includes mock data for a short German Big Five personality inventory and an age variable. The dataset follows the format created when importing data from formr.org. However, data imported using the haven package uses similar metadata. You can also add such metadata yourself, or use the codebook package for unannotated datasets.

As you can see below, the codebook package automatically computes reliabilities for multi-item inventories, generates nicely labelled plots and outputs summary statistics. The same information is also stored in a table, which you can export to various formats. Additionally, codebook can show you different kinds of (labelled) missing values, and show you common missingness patterns. As you cannot see, but search engines will, the codebook package also generates JSON-LD metadata for the dataset. If you share your codebook as an HTML file online, this metadata should make it easier for others to find your data. See what Google sees here.

knit_by_pkgdown <- !is.null(knitr::opts_chunk$get("fig.retina"))
knitr::opts_chunk$set(warning = FALSE, message = TRUE, error = FALSE)
pander::panderOptions("table.split.table", Inf)
ggplot2::theme_set(ggplot2::theme_bw())

library(codebook)
data("bfi", package = 'codebook')
if (!knit_by_pkgdown) {
  library(dplyr)
    bfi <- bfi %>% select(-starts_with("BFIK_extra"),
                        -starts_with("BFIK_open"),
                        -starts_with("BFIK_consc"))
}
set.seed(1)
bfi$age <- rpois(nrow(bfi), 30)
library(labelled)
var_label(bfi$age) <- "Alter"

By default, we only set the required metadata attributes name and description to sensible values. However, there is a number of attributes you can set to describe the data better. Find out more.

metadata(bfi)$name <- "MOCK Big Five Inventory dataset (German metadata demo)"
metadata(bfi)$description <- "a small mock Big Five Inventory dataset"
metadata(bfi)$identifier <- "doi:10.5281/zenodo.1326520"
metadata(bfi)$datePublished <- "2016-06-01"
metadata(bfi)$creator <- list(
      "@type" = "Person",
      givenName = "Ruben", familyName = "Arslan",
      email = "ruben.arslan@gmail.com", 
      affiliation = list("@type" = "Organization",
        name = "MPI Human Development, Berlin"))
metadata(bfi)$citation <- "Arslan (2016). Mock BFI data."
metadata(bfi)$url <- "https://rubenarslan.github.io/codebook/articles/codebook.html"
metadata(bfi)$temporalCoverage <- "2016" 
metadata(bfi)$spatialCoverage <- "Goettingen, Germany" 
# We don't want to look at the code in the codebook.
knitr::opts_chunk$set(warning = TRUE, message = TRUE, echo = FALSE)

Metadata

Description

Dataset name: MOCK Big Five Inventory dataset (German metadata demo)

a small mock Big Five Inventory dataset

Metadata for search engines

  • keywords: session, created, modified, ended, expired, BFIK_agree_4R, BFIK_agree_1R, BFIK_neuro_2R, BFIK_agree_3R, BFIK_neuro_3, BFIK_neuro_4, BFIK_agree_2, BFIK_agree, BFIK_neuro and age

Survey overview

28 completed rows, 28 who entered any information, 0 only viewed the first page. There are 0 expired rows (people who did not finish filling out in the requested time frame). In total, there are 28 rows including unfinished and expired rows.

There were 28 unique participants, of which 28 finished filling out at least one survey.

This survey was not repeated.

The first session started on 2016-07-08 09:54:16, the last session on 2016-11-02 21:19:50.

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

People took on average 127.36 minutes (median 1.48) to answer the survey.

## Warning: Durations below 0 detected.
## Warning: Removed 4 rows containing non-finite values (stat_bin).
## Warning: Removed 2 rows containing missing values (geom_bar).

Variables

Scale: BFIK_agree

Overview

Reliability: ωordinal [95% CI] = 0.61 [0.37;0.84].

Missing: 0.

Reliability details

Reliability Indices
Index Estimate
Omega 0.8193
Omega Psych Tot 0.8878
Omega Psych H 0.7664
Omega Ordinal 0.605
Cronbach Alpha 0.8006
Greatest Lower Bound 0.8858
Alpha Ordinal 0.5879

Positive correlations: 6 out of 6 (100%)

Scatter matrix

Detailed output

## 
## Information about this analysis:
## 
##                  Dataframe: res$dat
##                      Items: BFIK_agree_4R, BFIK_agree_1R, BFIK_agree_3R, BFIK_agree_2
##               Observations: 28
##      Positive correlations: 6 out of 6 (100%)
## 
## Estimates assuming interval level:
## 
##              Omega (total): 0.82
##       Omega (hierarchical): 0.77
##    Revelle's omega (total): 0.89
## Greatest Lower Bound (GLB): 0.89
##              Coefficient H: 0.88
##           Cronbach's alpha: 0.8
## Confidence intervals:
##              Omega (total): [0.71, 0.93]
##           Cronbach's alpha: [0.68, 0.92]
## 
## Estimates assuming ordinal level:
## 
##      Ordinal Omega (total): 0.61
##  Ordinal Omega (hierarch.): 0.59
##   Ordinal Cronbach's alpha: 0.59
## Confidence intervals:
##      Ordinal Omega (total): [0.37, 0.84]
##   Ordinal Cronbach's alpha: [0.33, 0.84]
## 
## Note: the normal point estimate and confidence interval for omega are based on the procedure suggested by Dunn, Baguley & Brunsden (2013) using the MBESS function ci.reliability, whereas the psych package point estimate was suggested in Revelle & Zinbarg (2008). See the help ('?scaleStructure') for more information.
## 
## Eigen values: 2.539, 0.732, 0.54, 0.189
## Loadings:
##               PC1  
## BFIK_agree_4R 0.871
## BFIK_agree_1R 0.748
## BFIK_agree_3R 0.880
## BFIK_agree_2  0.668
## 
##                  PC1
## SS loadings    2.539
## Proportion Var 0.635
## 
##               vars  n mean   sd median trimmed  mad min max range  skew
## BFIK_agree_4R    1 28 2.93 1.18      3    2.92 1.48   1   5     4  0.26
## BFIK_agree_1R    2 28 3.00 0.94      3    2.96 1.48   2   5     3  0.26
## BFIK_agree_3R    3 28 3.04 1.29      3    3.04 1.48   1   5     4  0.04
## BFIK_agree_2     4 28 3.50 1.26      4    3.58 1.48   1   5     4 -0.43
##               kurtosis   se
## BFIK_agree_4R    -1.18 0.22
## BFIK_agree_1R    -1.37 0.18
## BFIK_agree_3R    -1.35 0.24
## BFIK_agree_2     -1.03 0.24

Summary statistics

name label type type_options data_type value_labels optional item_order n_missing complete_rate min median max mean sd n_value_labels hist
BFIK_agree_4R Ich kann mich schroff und abweisend anderen gegenüber verhalten. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 5 0 1 1 3 5 2.928571 1.184110 6 ▂▇▁▃▁▅▁▂
BFIK_agree_1R Ich neige dazu, andere zu kritisieren. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 7 0 1 2 3 5 3.000000 0.942809 6 ▇▁▅▁▁▆▁▁
BFIK_agree_3R Ich kann mich kalt und distanziert verhalten. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 13 0 1 1 3 5 3.035714 1.290482 6 ▂▇▁▃▁▇▁▃
BFIK_agree_2 Ich schenke anderen leicht Vertrauen, glaube an das Gute im Menschen. rating_button 5 haven_labelled 1. 1: Trifft überhaupt nicht zu,
2. 2,
3. 3,
4. 4,
5. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 17 0 1 1 4 5 3.500000 1.261980 6 ▂▅▁▅▁▇▁▆

Scale: BFIK_neuro

Overview

Reliability: ωordinal [95% CI] = 0.66 [0.43;0.9].

Missing: 0.

Reliability details

Reliability Indices
Index Estimate
Omega 0.8191
Omega Psych Tot 0.7954
Omega Psych H 0.03191
Omega Ordinal 0.665
Cronbach Alpha 0.7537
Greatest Lower Bound 0.8345
Alpha Ordinal 0.6023

Positive correlations: 3 out of 3 (100%)

Scatter matrix

Detailed output

## 
## Information about this analysis:
## 
##                  Dataframe: res$dat
##                      Items: BFIK_neuro_2R, BFIK_neuro_3, BFIK_neuro_4
##               Observations: 28
##      Positive correlations: 3 out of 3 (100%)
## 
## Estimates assuming interval level:
## 
##              Omega (total): 0.82
##       Omega (hierarchical): 0.03
##    Revelle's omega (total): 0.8
## Greatest Lower Bound (GLB): 0.83
##              Coefficient H: 0.98
##           Cronbach's alpha: 0.75
## Confidence intervals:
##              Omega (total): [0.71, 0.93]
##           Cronbach's alpha: [0.58, 0.92]
## 
## Estimates assuming ordinal level:
## 
##      Ordinal Omega (total): 0.66
##  Ordinal Omega (hierarch.): 0.64
##   Ordinal Cronbach's alpha: 0.6
## Confidence intervals:
##      Ordinal Omega (total): [0.43, 0.9]
##   Ordinal Cronbach's alpha: [0.34, 0.86]
## 
## Note: the normal point estimate and confidence interval for omega are based on the procedure suggested by Dunn, Baguley & Brunsden (2013) using the MBESS function ci.reliability, whereas the psych package point estimate was suggested in Revelle & Zinbarg (2008). See the help ('?scaleStructure') for more information.
## 
## Eigen values: 2.015, 0.723, 0.262
## Loadings:
##               PC1  
## BFIK_neuro_2R 0.670
## BFIK_neuro_3  0.863
## BFIK_neuro_4  0.907
## 
##                  PC1
## SS loadings    2.015
## Proportion Var 0.672
## 
##               vars  n mean   sd median trimmed  mad min max range skew kurtosis
## BFIK_neuro_2R    1 28 3.11 0.88      3    3.08 1.48   2   5     3 0.12    -1.14
## BFIK_neuro_3     2 28 3.07 1.27      3    3.08 1.48   1   5     4 0.08    -1.14
## BFIK_neuro_4     3 28 2.50 1.20      2    2.50 1.48   1   4     3 0.12    -1.60
##                 se
## BFIK_neuro_2R 0.17
## BFIK_neuro_3  0.24
## BFIK_neuro_4  0.23

Summary statistics

name label type type_options data_type value_labels optional item_order n_missing complete_rate min median max mean sd n_value_labels hist
BFIK_neuro_2R Ich bin entspannt, lasse mich durch Stress nicht aus der Ruhe bringen. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 9 0 1 2 3 5 3.107143 0.8751417 6 ▆▁▇▁▁▇▁▁
BFIK_neuro_3 Ich mache mir viele Sorgen. rating_button 5 haven_labelled 1. 1: Trifft überhaupt nicht zu,
2. 2,
3. 3,
4. 4,
5. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 15 0 1 1 3 5 3.071429 1.2744954 6 ▃▇▁▇▁▅▁▅
BFIK_neuro_4 Ich werde leicht nervös und unsicher. rating_button 5 haven_labelled 1. 1: Trifft überhaupt nicht zu,
2. 2,
3. 3,
4. 4,
5. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 16 0 1 1 2 4 2.500000 1.2018504 6 ▆▁▇▁▁▂▁▇

age

Alter

Distribution

0 missing values.

Summary statistics

name label data_type n_missing complete_rate min median max mean sd hist
age Alter numeric 0 1 19 32 38 30.5 4.670633 ▂▂▇▇▅

Missingness report

JSON-LD metadata The following JSON-LD can be found by search engines, if you share this codebook publicly on the web.

{
  "name": "MOCK Big Five Inventory dataset (German metadata demo)",
  "description": "a small mock Big Five Inventory dataset\n\n\n## Table of variables\nThis table contains variable names, labels, and number of missing values.\nSee the complete codebook for more.\n\n|name          |label                                                                      | n_missing|\n|:-------------|:--------------------------------------------------------------------------|---------:|\n|session       |NA                                                                         |         0|\n|created       |user first opened survey                                                   |         0|\n|modified      |user last edited survey                                                    |         0|\n|ended         |user finished survey                                                       |         0|\n|expired       |NA                                                                         |        28|\n|BFIK_agree_4R |__Ich kann mich schroff und abweisend anderen gegenüber verhalten.__       |         0|\n|BFIK_agree_1R |__Ich neige dazu, andere zu kritisieren.__                                 |         0|\n|BFIK_neuro_2R |__Ich bin entspannt, lasse mich durch Stress nicht aus der Ruhe bringen.__ |         0|\n|BFIK_agree_3R |__Ich kann mich kalt und distanziert verhalten.__                          |         0|\n|BFIK_neuro_3  |__Ich mache mir viele Sorgen.__                                            |         0|\n|BFIK_neuro_4  |__Ich werde leicht nervös und unsicher.__                                  |         0|\n|BFIK_agree_2  |__Ich schenke anderen leicht Vertrauen, glaube an das Gute im Menschen.__  |         0|\n|BFIK_agree    |4 BFIK_agree items averaged with aggregation_function                      |         0|\n|BFIK_neuro    |3 BFIK_neuro items averaged with aggregation_function                      |         0|\n|age           |Alter                                                                      |         0|\n\n### Note\nThis dataset was automatically described using the [codebook R package](https://rubenarslan.github.io/codebook/) (version 0.8.2).",
  "identifier": "doi:10.5281/zenodo.1326520",
  "datePublished": "2016-06-01",
  "creator": {
    "@type": "Person",
    "givenName": "Ruben",
    "familyName": "Arslan",
    "email": "ruben.arslan@gmail.com",
    "affiliation": {
      "@type": "Organization",
      "name": "MPI Human Development, Berlin"
    }
  },
  "citation": "Arslan (2016). Mock BFI data.",
  "url": "https://rubenarslan.github.io/codebook/articles/codebook.html",
  "temporalCoverage": "2016",
  "spatialCoverage": "Goettingen, Germany",
  "keywords": ["session", "created", "modified", "ended", "expired", "BFIK_agree_4R", "BFIK_agree_1R", "BFIK_neuro_2R", "BFIK_agree_3R", "BFIK_neuro_3", "BFIK_neuro_4", "BFIK_agree_2", "BFIK_agree", "BFIK_neuro", "age"],
  "@context": "http://schema.org/",
  "@type": "Dataset",
  "variableMeasured": [
    {
      "name": "session",
      "@type": "propertyValue"
    },
    {
      "name": "created",
      "description": "user first opened survey",
      "@type": "propertyValue"
    },
    {
      "name": "modified",
      "description": "user last edited survey",
      "@type": "propertyValue"
    },
    {
      "name": "ended",
      "description": "user finished survey",
      "@type": "propertyValue"
    },
    {
      "name": "expired",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_agree_4R",
      "description": "__Ich kann mich schroff und abweisend anderen gegenüber verhalten.__",
      "value": "5. 1: Trifft überhaupt nicht zu,\n4. 2,\n3. 3,\n2. 4,\n1. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_agree_1R",
      "description": "__Ich neige dazu, andere zu kritisieren.__",
      "value": "5. 1: Trifft überhaupt nicht zu,\n4. 2,\n3. 3,\n2. 4,\n1. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_neuro_2R",
      "description": "__Ich bin entspannt, lasse mich durch Stress nicht aus der Ruhe bringen.__",
      "value": "5. 1: Trifft überhaupt nicht zu,\n4. 2,\n3. 3,\n2. 4,\n1. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_agree_3R",
      "description": "__Ich kann mich kalt und distanziert verhalten.__",
      "value": "5. 1: Trifft überhaupt nicht zu,\n4. 2,\n3. 3,\n2. 4,\n1. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_neuro_3",
      "description": "__Ich mache mir viele Sorgen.__",
      "value": "1. 1: Trifft überhaupt nicht zu,\n2. 2,\n3. 3,\n4. 4,\n5. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_neuro_4",
      "description": "__Ich werde leicht nervös und unsicher.__",
      "value": "1. 1: Trifft überhaupt nicht zu,\n2. 2,\n3. 3,\n4. 4,\n5. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_agree_2",
      "description": "__Ich schenke anderen leicht Vertrauen, glaube an das Gute im Menschen.__",
      "value": "1. 1: Trifft überhaupt nicht zu,\n2. 2,\n3. 3,\n4. 4,\n5. 5: Trifft voll und ganz zu,\nNA. Item was never rendered for this user.",
      "maxValue": 5,
      "minValue": 1,
      "measurementTechnique": "self-report",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_agree",
      "description": "4 BFIK_agree items averaged with aggregation_function",
      "@type": "propertyValue"
    },
    {
      "name": "BFIK_neuro",
      "description": "3 BFIK_neuro items averaged with aggregation_function",
      "@type": "propertyValue"
    },
    {
      "name": "age",
      "description": "Alter",
      "@type": "propertyValue"
    }
  ]
}`

Codebook table

name label type type_options data_type value_labels optional scale_item_names item_order n_missing complete_rate n_unique empty count min median max mean sd whitespace n_value_labels hist
session NA NA NA character NA NA NA NA 0 1 28 0 NA 64 NA 64 NA NA 0 NA NA
created user first opened survey NA NA POSIXct NA NA NA NA 0 1 28 NA NA 2016-07-08 09:54:16 2016-07-08 12:47:07 2016-11-02 21:19:50 NA NA NA NA NA
modified user last edited survey NA NA POSIXct NA NA NA NA 0 1 28 NA NA 2016-07-08 09:55:43 2016-07-08 14:23:22 2016-11-02 21:21:53 NA NA NA NA NA
ended user finished survey NA NA POSIXct NA NA NA NA 0 1 28 NA NA 2016-07-08 09:55:43 2016-07-08 14:23:22 2016-11-02 21:21:53 NA NA NA NA NA
expired NA NA NA logical NA NA NA NA 28 0 NA NA : NA NA NA NaN NA NA NA NA
BFIK_agree_4R Ich kann mich schroff und abweisend anderen gegenüber verhalten. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 5 0 1 NA NA NA 1 3 5 2.928571 1.1841100 NA 6 ▂▇▁▃▁▅▁▂
BFIK_agree_1R Ich neige dazu, andere zu kritisieren. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 7 0 1 NA NA NA 2 3 5 3.000000 0.9428090 NA 6 ▇▁▅▁▁▆▁▁
BFIK_neuro_2R Ich bin entspannt, lasse mich durch Stress nicht aus der Ruhe bringen. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 9 0 1 NA NA NA 2 3 5 3.107143 0.8751417 NA 6 ▆▁▇▁▁▇▁▁
BFIK_agree_3R Ich kann mich kalt und distanziert verhalten. rating_button 5 haven_labelled 5. 1: Trifft überhaupt nicht zu,
4. 2,
3. 3,
2. 4,
1. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 13 0 1 NA NA NA 1 3 5 3.035714 1.2904820 NA 6 ▂▇▁▃▁▇▁▃
BFIK_neuro_3 Ich mache mir viele Sorgen. rating_button 5 haven_labelled 1. 1: Trifft überhaupt nicht zu,
2. 2,
3. 3,
4. 4,
5. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 15 0 1 NA NA NA 1 3 5 3.071429 1.2744954 NA 6 ▃▇▁▇▁▅▁▅
BFIK_neuro_4 Ich werde leicht nervös und unsicher. rating_button 5 haven_labelled 1. 1: Trifft überhaupt nicht zu,
2. 2,
3. 3,
4. 4,
5. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 16 0 1 NA NA NA 1 2 4 2.500000 1.2018504 NA 6 ▆▁▇▁▁▂▁▇
BFIK_agree_2 Ich schenke anderen leicht Vertrauen, glaube an das Gute im Menschen. rating_button 5 haven_labelled 1. 1: Trifft überhaupt nicht zu,
2. 2,
3. 3,
4. 4,
5. 5: Trifft voll und ganz zu,
NA. Item was never rendered for this user.
0 NA 17 0 1 NA NA NA 1 4 5 3.500000 1.2619796 NA 6 ▂▅▁▅▁▇▁▆
BFIK_agree 4 BFIK_agree items averaged with aggregation_function NA NA numeric NA NA BFIK_agree_4R, BFIK_agree_1R, BFIK_agree_3R, BFIK_agree_2 NA 0 1 NA NA NA 1.5 3.0 4.8 3.116071 0.9316506 NA NA ▂▇▅▅▃
BFIK_neuro 3 BFIK_neuro items averaged with aggregation_function NA NA numeric NA NA BFIK_neuro_2R, BFIK_neuro_3, BFIK_neuro_4 NA 0 1 NA NA NA 1.3 2.8 4.3 2.892857 0.9254231 NA NA ▅▇▇▆▇
age Alter NA NA numeric NA NA NA NA 0 1 NA NA NA 19.0 32.0 38.0 30.500000 4.6706332 NA NA ▂▂▇▇▅