| Title: | Utilities to Work with 'GESIS AppKit' Data |
|---|---|
| Description: | Provides helper functions for importing and processing survey data exported from the 'GESIS AppKit' platform <https://www.gesis.org/en/gesis-appkit>. Includes support for extracting variable and value labels from 'SPSS' syntax files, and automatically attaching these labels to raw CSV survey data for clean analysis. |
| Authors: | Maximilian Haag [aut, cre] (ORCID: <https://orcid.org/0000-0002-0334-9270>), Charlotte de Alwis [aut] (ORCID: <https://orcid.org/0009-0004-8903-7500>), Julian Kohne [aut] (ORCID: <https://orcid.org/0000-0002-6710-7545>), GESIS - Leibniz Institute for the Social Sciences [cph] |
| Maintainer: | Maximilian Haag <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 2.0.0.5 |
| Built: | 2026-11-14 00:27:29 UTC |
| Source: | https://github.com/cran/appkitr |
This is synthetic example data intended to allow users to test the package's functions. The variables are from a study conducted by the GESIS AppKit Team on measuring emotionality in social interactions through momentary assessments. This is the entry survey, which includes items from the affect intensity measure questionnaire.
appkit_survey_entryappkit_survey_entry
A data frame with 20 rows and 40 columns:
personalParticipantCodePersonalParticipantCode
generalLoginCodeGeneralLoginCode
statusParticipant Status
lastStatusChangeLast Status Change
noteNote
firstOpenedFirst Opened
committedCommitted
scheduledScheduled
expiredExpired
publishedPublished
exportedExported
osVersionOS Version
smartphoneTypeSmartphoneType
pushNotificationAllowedPush Notification Allowed
notificationTypeNotification Type
notificationTitleNotification Title
notificationTextNotification Text
ageHow old are you (in years)?
sexWhich sex was assigned to you at birth?
genderWhat is your gender?
aim01When I feel happiness, it is a quite type of contentment.
aim02When a person in a wheelchair can't get through a door, I have strong feelings of pity.
aim03I get upset easily.
aim04When I succeed at something, my reaction is calm contentment.
aim05I get really happy or really unhappy.
aim06I am a fairly quiet person.
aim07When I'm happy, I feel fairly energetic.
aim08Seeing a picture of some violent car accident in a newspaper makes me feel sick to my stomach.
aim09When I'm happy, I feel like I'm bursting with joy.
aim10I would be very upset, if I got a traffic ticket.
aim11Looking at beautiful scenery really doesn't affect me much.
aim12The weather doesn't affect my mood.
aim13Others tend to get more excited than I do.
aim14I am not an extremely enthusiastic individual.
aim15Calm and cool could easily describe me.
aim16When I'm feeling well it is easy for me to go from being in a good mood to being really joyful.
aim17When I worry, it is so mild I hardly notice it.
aim18I get overly enthusiastic.
aim19My happy moods are so strong that I feel like I'm 'in heaven'.
aim20When something bad happens, others tend to be more unhappy than I.
This is synthetic example data intended to allow users to test the package's functions. The variables are from a study conducted by the GESIS AppKit Team on measuring emotionality in social interactions through momentary assessments. This is the experience sampling survey, which captures the momentary assessments of emotions in social interactions.
appkit_survey_esmappkit_survey_esm
A data frame with 180 rows and 36 columns:
personalParticipantCodePersonalParticipantCode
generalLoginCodeGeneralLoginCode
statusParticipant Status
lastStatusChangeLast Status Change
noteNote
firstOpenedFirst Opened
committedCommitted
scheduledScheduled
expiredExpired
publishedPublished
exportedExported
osVersionOS Version
smartphoneTypeSmartphoneType
pushNotificationAllowedPush Notification Allowed
notificationTypeNotification Type
notificationTitleNotification Title
notificationTextNotification Text
screeningHave you been part of any social interaction in the last two hours?
descriptionPlease briefly describe the type of social interaction.
delayHow many minutes ago did this interaction take place?
durationHow long did the interaction last?
groupsizeHow many people took part in the interaction (you included)?
partner_genderWhat gender do you ascribe to your (main) interaction partner?
partner_closeHow close do you consider the relationship to your (main) interaction partner?
interaction_qualityPlease indicate your perceived quality of the interaction.
interaction_intimacyPlease indicate the intimacy of the interaction.
interaction_controlPlease indicate your perceived degree of control over the interaction in comparison to your main interaction partner.
interaction_intensityPlease indicate the overall intensity of your emotional experience during the interaction.
emo_happyPlease indicate how happy you felt during the interaction.
emo_sadPlease indicate how sad you felt during the interaction.
emo_nervousPlease indicate how nervous you felt during the interaction.
emo_surprisePlease indicate how surprised you felt during the interaction.
emo_angryPlease indicate how angry you felt during the interaction.
emo_embarrassedPlease indicate how embarrassed you felt during the interaction.
emo_ashamedPlease indicate how ashamed you felt during the interaction.
dataqualityThank you very much for supporting our research. For ensuring data quality, please indicate whether you answered the questions within this survey conscientiously:
This is synthetic example data intended to allow users to test the package's functions. The variables are from a study conducted by the GESIS AppKit Team on measuring emotionality in social interactions through momentary assessments. This is the exit survey, which includes items from the personal attributes questionnaire.
appkit_survey_exitappkit_survey_exit
A data frame with 20 rows and 33 columns:
personalParticipantCodePersonalParticipantCode
generalLoginCodeGeneralLoginCode
statusParticipant Status
lastStatusChangeLast Status Change
noteNote
firstOpenedFirst Opened
committedCommitted
scheduledScheduled
expiredExpired
publishedPublished
exportedExported
osVersionOS Version
smartphoneTypeSmartphoneType
pushNotificationAllowedPush Notification Allowed
notificationTypeNotification Type
notificationTitleNotification Title
notificationTextNotification Text
paqf1I am emotional.
paqf2I am able to devote myself completely to others.
paqf3I am understanding.
paqf4I am gentle.
paqf5I am helpful to others.
paqf6I am kind.
paqf7I am unaware of the feelings of others.
paqf8I am warm in relation to others.
paqm1I am independent.
paqm2I am a proactive person.
paqm3I am competitive.
paqm4I have difficulties making decisions.
paqm5I give up easily.
paqm6I feel superior.
paqm7I am self-confident.
paqm8I function well under pressure.
Calculates the payout per participant according to a payout scheme. Supports two payment types per survey: a fixed amount per committed questionnaire, and/or a one-time bonus once a minimum number of committed questionnaires per survey is reached.
calculate_payout( data, payout_scheme, participant_col = .appkit_col("participant"), scheduled_col = .appkit_col("scheduled"), committed_col = .appkit_col("committed"), exported_col = .appkit_col("exported") )calculate_payout( data, payout_scheme, participant_col = .appkit_col("participant"), scheduled_col = .appkit_col("scheduled"), committed_col = .appkit_col("committed"), exported_col = .appkit_col("exported") )
data |
Either a single survey data frame (as returned by
|
payout_scheme |
A data frame with one row per payout rule, and columns:
|
participant_col |
Character string naming the participant ID column (default: |
scheduled_col |
Character string naming the scheduled-timestamp column (default: |
committed_col |
Character string naming the committed-timestamp column (default: |
exported_col |
Character string naming the export-timestamp column, used internally by |
A data frame with one row per participant and one column per
survey (payout amount for that survey), plus a total column (sum
across all surveys).
This function is provided as a calculation aid only. It comes with no guarantee of correctness. Always manually verify payout amounts before making any actual payments.
payout_scheme <- data.frame( survey = c("appkit_survey_esm", "appkit_survey_esm"), type = c("per_questionnaire", "threshold"), threshold_n = c(NA, 10), amount = c(2.00, 15.00) ) payout <- calculate_payout(appkit_survey_esm, payout_scheme) head(payout)payout_scheme <- data.frame( survey = c("appkit_survey_esm", "appkit_survey_esm"), type = c("per_questionnaire", "threshold"), threshold_n = c(NA, 10), amount = c(2.00, 15.00) ) payout <- calculate_payout(appkit_survey_esm, payout_scheme) head(payout)
This command walks the user through each survey in the input data,
asking whether to include a payout rule for each one and, if so, which type(s).
This avoids manually constructing a payout_scheme data frame,
which might be more error-prone.
create_payout_scheme(data)create_payout_scheme(data)
data |
Either a single survey data frame (as returned by
|
A payout_scheme data frame, suitable for calculate_payout().
if (interactive()) { payout_scheme <- create_payout_scheme(appkit_survey_esm) payout_scheme }if (interactive()) { payout_scheme <- create_payout_scheme(appkit_survey_esm) payout_scheme }
Removes rows matching specified participant IDs from a data frame or
a list of data frames (as returned by read_appkit_surveys()).
drop_participants(data, participant_ids, id_col = .appkit_col("participant"))drop_participants(data, participant_ids, id_col = .appkit_col("participant"))
data |
A data frame or a named list of data frames. |
participant_ids |
Character vector of participant IDs to remove. |
id_col |
Character string naming the column that contains participant IDs (default: the AppKit participant code column |
When data is a list of data frames, the function applies the drop
operation to each element and reports results per survey.
If any values in participant_ids are not found in the data, a warning
is issued listing the unmatched IDs.
Object of the same type as data, with matching rows removed.
# Drop two participants from the bundled example survey ids <- appkit_survey_entry$personalParticipantCode[1:2] entry_small <- drop_participants(appkit_survey_entry, ids) # Drop participants from a named list of surveys surveys <- list(entry = appkit_survey_entry) surveys <- drop_participants(surveys, ids)# Drop two participants from the bundled example survey ids <- appkit_survey_entry$personalParticipantCode[1:2] entry_small <- drop_participants(appkit_survey_entry, ids) # Drop participants from a named list of surveys surveys <- list(entry = appkit_survey_entry) surveys <- drop_participants(surveys, ids)
Extracts and formats information about a single variable including its label, unique values, and value labels.
inspect_variable(var, var_name = NULL, max_unique = 10, max_width = 50)inspect_variable(var, var_name = NULL, max_unique = 10, max_width = 50)
var |
The variable to inspect |
var_name |
The name of the variable (optional, auto-detected if not provided) |
max_unique |
Maximum number of unique values to display (default: 10) |
max_width |
Maximum width for displaying unique values (default: 50) |
A one-row data frame with variable information
# Inspect a single variable of the bundled example survey var_info <- inspect_variable(appkit_survey_entry$aim01)# Inspect a single variable of the bundled example survey var_info <- inspect_variable(appkit_survey_entry$aim01)
Provides a formatted overview of variables in a data frame, showing variable names, labels, unique values, and value labels. Can also inspect a single variable.
inspect_variables(data, max_unique = 10, max_width = 50, verbose = TRUE)inspect_variables(data, max_unique = 10, max_width = 50, verbose = TRUE)
data |
A data frame or a single variable to inspect |
max_unique |
Integer indicating the maximum number of unique values to display (default: 10) |
max_width |
Integer indicating the maximum width for displaying unique values (default: 50) |
verbose |
Logical, if set to FALSE, suppresses all console output (default: TRUE) |
A tibble-like display of variable information (returned invisibly)
# Inspect all variables in the bundled example survey inspect_variables(appkit_survey_entry)# Inspect all variables in the bundled example survey inspect_variables(appkit_survey_entry)
Creates a table summarizing, for each participant, how many questionnaires they committed per survey, either as absolute counts or as a percentage.
participation_table( data, value = c("count", "percentage"), include_future_scheduled = FALSE, participant_col = .appkit_col("participant"), scheduled_col = .appkit_col("scheduled"), committed_col = .appkit_col("committed"), exported_col = .appkit_col("exported") )participation_table( data, value = c("count", "percentage"), include_future_scheduled = FALSE, participant_col = .appkit_col("participant"), scheduled_col = .appkit_col("scheduled"), committed_col = .appkit_col("committed"), exported_col = .appkit_col("exported") )
data |
Either a single survey data frame (as returned by
|
value |
Character. Either |
include_future_scheduled |
Logical. The export contains rows for questionnaires scheduled in the future. Calculating percentages mid-study can therefore be misleading. If |
participant_col |
Character string naming the participant ID column (default: |
scheduled_col |
Character string naming the scheduled-timestamp column (default: |
committed_col |
Character string naming the committed-timestamp column (default: |
exported_col |
Character string naming the export-timestamp column, used as the reference time for |
A data frame with one row per participant and one column per survey (plus personalParticipantCode), containing counts or completion percentages. Participants are included if they appear in at least one of the supplied surveys.
# count of committed questionnaires per participant survey_count <- participation_table(appkit_survey_esm, include_future_scheduled = TRUE) head(survey_count) # percentage of committed questionnaires per participant survey_pct <- participation_table( appkit_survey_esm, value = "percentage", include_future_scheduled = TRUE ) head(survey_pct) # participation for multiple surveys, combined in a list surveys_count <- participation_table( list(survey_esm = appkit_survey_esm, survey_exit = appkit_survey_exit), include_future_scheduled = TRUE ) head(surveys_count)# count of committed questionnaires per participant survey_count <- participation_table(appkit_survey_esm, include_future_scheduled = TRUE) head(survey_count) # percentage of committed questionnaires per participant survey_pct <- participation_table( appkit_survey_esm, value = "percentage", include_future_scheduled = TRUE ) head(survey_pct) # participation for multiple surveys, combined in a list surveys_count <- participation_table( list(survey_esm = appkit_survey_esm, survey_exit = appkit_survey_exit), include_future_scheduled = TRUE ) head(surveys_count)
Reads an AppKit survey dataset from a directory containing both a CSV file and an SPS syntax file. Automatically applies variable and value labels, converts eligible character columns to logical, and handles NA values.
read_appkit_survey( survey_directory, na_values = list(-1, "", "Not applicable", "N/A"), timestamp_cols = .appkit_timestamp_cols() )read_appkit_survey( survey_directory, na_values = list(-1, "", "Not applicable", "N/A"), timestamp_cols = .appkit_timestamp_cols() )
survey_directory |
A character string specifying the path to a directory containing both a .csv data file and a .sps syntax file. |
na_values |
Optional list or vector of values to treat as NA (default: list(-1, "", "Not applicable", "N/A")). All specified values will be converted to NA across all columns with appropriate type handling. |
timestamp_cols |
Character vector of column names to parse as timestamps (default: the AppKit timestamp columns lastStatusChange, firstOpened, committed, scheduled, expired, published, exported). Columns not present in the data are ignored. |
The function performs the following operations
Reads the CSV file using semicolon separator
Converts specified values to NA with type-appropriate handling
Converts character columns containing only "true"/"false" to logical
Parses the timestamp_cols columns with multiple format attempts
Extracts variable and value labels from the SPS file
Applies labels to the data frame (variable labels as attributes, value labels as factors)
A data frame containing the processed survey data with variable and value labels applied as attributes and appropriate data types set.
survey_dir <- system.file("extdata", "example_survey", package = "appkitr", mustWork = TRUE ) # Read survey from directory with default settings survey <- read_appkit_survey(survey_dir) # Read survey and treat custom values as missing survey <- read_appkit_survey(survey_dir, na_values = c(-1, -99))survey_dir <- system.file("extdata", "example_survey", package = "appkitr", mustWork = TRUE ) # Read survey from directory with default settings survey <- read_appkit_survey(survey_dir) # Read survey and treat custom values as missing survey <- read_appkit_survey(survey_dir, na_values = c(-1, -99))
Reads multiple AppKit surveys from a parent directory where each subdirectory contains one survey (CSV + SPS files). Returns a named list of data frames.
read_appkit_surveys( surveys_directory, na_values = list(-1, "", "Not applicable", "N/A"), duplicate_names = "error", timestamp_cols = .appkit_timestamp_cols() )read_appkit_surveys( surveys_directory, na_values = list(-1, "", "Not applicable", "N/A"), duplicate_names = "error", timestamp_cols = .appkit_timestamp_cols() )
surveys_directory |
A character string specifying the path to a directory containing subdirectories, each with survey data (CSV + SPS files). |
na_values |
Optional list or vector of values to treat as NA across all surveys (default: list(-1, "", "Not applicable", "N/A")). All specified values will be converted to NA across all columns with appropriate type handling. |
duplicate_names |
Character string specifying how to handle surveys with identical names. Options are:
|
timestamp_cols |
Character vector of column names to parse as timestamps across all surveys (default: the AppKit timestamp columns). Columns not present in a survey are ignored. |
A named list where each element is a processed survey data frame. Names are derived from the CSV filenames (with .csv extension removed and spaces replaced with underscores).
surveys_dir <- system.file("extdata", "example_surveys", package = "appkitr", mustWork = TRUE ) # Read all surveys from a parent directory (default: error on duplicates) surveys <- read_appkit_surveys(surveys_dir) # Read surveys and merge those with identical names surveys <- read_appkit_surveys(surveys_dir, duplicate_names = "merge") # Read surveys and keep duplicates distinct with suffixes surveys <- read_appkit_surveys(surveys_dir, duplicate_names = "distinct") # Read surveys with custom NA values surveys <- read_appkit_surveys(surveys_dir, na_values = c(-1, -99, "")) # Access individual surveys survey1 <- surveys[["survey_name_1"]]surveys_dir <- system.file("extdata", "example_surveys", package = "appkitr", mustWork = TRUE ) # Read all surveys from a parent directory (default: error on duplicates) surveys <- read_appkit_surveys(surveys_dir) # Read surveys and merge those with identical names surveys <- read_appkit_surveys(surveys_dir, duplicate_names = "merge") # Read surveys and keep duplicates distinct with suffixes surveys <- read_appkit_surveys(surveys_dir, duplicate_names = "distinct") # Read surveys with custom NA values surveys <- read_appkit_surveys(surveys_dir, na_values = c(-1, -99, "")) # Access individual surveys survey1 <- surveys[["survey_name_1"]]