Exploring Data Sets

Daniel Lüdecke

2025-07-30

Tidying up, transforming and exploring data is an important part of data analysis, and you can manage many common tasks in this process with the tidyverse or related packages. The sjmisc-package fits into this workflow, especially when you work with labelled data, because it offers functions for data transformation and labelled data utility functions. This vignette describes typical steps when beginning with data exploration.

The examples are based on data from the EUROFAMCARE project, a survey on the situation of family carers of older people in Europe. The sample data set efc is part of this package. Let us see how the family carer’s gender and subjective perception of negative impact of care as well as the cared-for person’s dependency are associated with the family carer’s quality of life.

library(sjmisc)
library(dplyr)
data(efc)

Find variables in a data frame

Next, let’s look at the distribution of gender by the cared-for person’s dependency. To compute cross tables, you can use flat_table(). It requires the data as first argument, followed by any number of variable names.

But first, we need to know the name of the dependency-variable. This is where find_var() comes into play. It searches for variables in a data frame by

  1. variable names,
  2. variable labels,
  3. value labels
  4. or any combination of these.

By default, it looks for variable name and labels. The function also supports regex-patterns. By default, find_var() returns the column-indices, but you can also print a small “summary”” with the out-argument.

# find all variables with "dependency" in name or label
find_var(efc, "dependency", out = "table")
#>   col.nr var.name          var.label
#> 1      5   e42dep elder's dependency

Variable in column 5, named e42dep