Learn R Programming

gmoTree – Get and Modify oTree Data

gmoTree is an R package developed for importing, merging, and efficiently managing data obtained from running oTree (Chen et al., 2016) experiments. It’s particularly valuable when dealing with complex experimental designs that span multiple sessions and generate a large number of files that need to be integrated.[^1]

[^1]: gmoTree is not an official package of the oTree team but is built to complement the oTree open-source platform.

Installation

To install the CRAN version of this package, use the following command:

install.packages("gmoTree")

To install the development version:

devtools::install_github("ZauchnerP/gmoTree")

List of all functions

See the page Introduction to gmoTree for a more detailed overview of most of the functions. For further details on the package as a whole, visit the gmoTree website.

Importing data

  • import_otree(): Imports your oTree data and combines them in a list of data frames.

Cleaning up data

  • messy_chat(): Checks for a messy Chats data frame and combines variables that refer to

the same concept.

  • messy_chat(): Checks for a messy Time data frame and combines variables that refer to

the same concept.

  • delete_duplicate(): Deletes duplicate rows from all data frames

in the list of data frames.

Dealing with dropouts and deleting cases

  • show_dropouts(): Shows participant codes of people who did not finish at (a) certain

app(s) or page(s).

  • delete_dropouts(): Deletes the data of participants who did not finish at (a) certain

app(s) or page(s). This function deletes the participants’ data from all data frames in the list of data frames. Caution: It does not delete the cases from the original CSV and Excel files!

  • delete_cases(): Deletes the data of specified participants from all data frames in the list of data frames. Caution: This function does not delete the data from the

original CSV and Excel files!

  • delete_sessions(): Deletes the data of specified sessions from all data frames in the oTree

list. Caution: This function does not delete the data from the original CSV and Excel files!

Deleting sensitive information

  • delete_plabels(): Deletes the variable participant.label from every app because it might

contain identifiable information on the participants, such as their MTurk ID. Caution: This function does not delete the variable from the original CSV and Excel files!

Making IDs

  • make_ids(): Makes participant, group, and session IDs that are the same across all

apps.

Measuring time

  • apptime(): Calculates the time spent on a specific app.

  • extime(): Calculates the time spent on the experiment.

  • pagesec(): Calculates the time spent on each page.

Transferring variables between the apps

  • assignv(): Copies a variable from the all_apps_wide data frame to the data frames

of all other apps.

  • assignv_to_aaw(): Copies a variable from one of your data frames to the all_apps_wide data

frame.

Before running the experiment

  • show_constant(): Shows variables with no variation.

  • codebook(): Creates a codebook based on the oTree code. See also the vignette gmoTree Codebooks.

References

Chen, D. L., Schonger, M., & Wickens, C. (2016). oTree—An open-source platform for laboratory, online, and field experiments. Journal of Behavioral and Experimental Finance, 9, 88–97. https://doi.org/10.1016/j.jbef.2015.12.001

Copy Link

Version

Install

install.packages('gmoTree')

Monthly Downloads

225

Version

1.4.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Patricia F. Zauchner

Last Published

February 4th, 2025

Functions in gmoTree (1.4.1)

extime

Calculate the time that was spent on the whole experiment
delete_plabels

Delete participant labels in all apps
delete_sessions

Delete all cases of one session
delete_duplicate

Delete duplicate data
messy_chat

Check if the Chats data frame is messy
pagesec

Calculate the seconds spent on each page
make_ids

Make IDs
messy_time

Check if the Time data frame is messy
oTree

Sample experimental data
show_constant

Show constant columns
import_otree

Import oTree data
show_dropouts

Show participants who did not finish the experiment
delete_cases

Delete specific cases
assignv_to_aaw

Assign a variable to all_apps_wide
codebook

Create a codebook for the oTree code
assignv

Assign a variable from all_apps_wide
delete_dropouts

Delete dropouts
apptime

Calculate the time that was spent on an app