Delete duplicate rows from all oTree app data frames
and $all_apps_wide
.
Arguments
- oTree
A list of data frames that were created by
import_otree
.
Value
This function returns a duplicate of the original oTree
list of data frames but without duplicate rows in all app data
frames and $all_apps_wide
. This function has no effect on the data
frames $Time
and $Chats
.
This function does NOT add information to $info$deleted_cases
,
because it does not delete any important information but only
cleans up a messy data import.
However, the function adjusts $info$initial_n
, if
an $all_apps_wide
data frame exists.
Examples
# Set data folder first
withr::with_dir(system.file("extdata", package = "gmoTree"), {
# Import all oTree files in this folder and its subfolders
oTree <- import_otree()
})
#> Warning: You have stored all_apps_wide globally but also room-specific. This function will import both of them. (Globally, the files are saved as "all_apps_wide_." Room-specific, the files are saved as "All apps - wide-" or "all_apps_wide-.") After importing the data, make sure nothing is there twice! (Advice: You may use delete_duplicate() to remove duplicate rows of all oTree data frames.
# First, show some row numbers
print(paste(nrow(oTree$all_apps_wide), nrow(oTree$survey),
nrow(oTree$Time), nrow(oTree$Chats)))
#> [1] "41 33 366 41"
# Delete duplicate rows
oTree <- delete_duplicate(oTree)
# Show row numbers again
print(paste(nrow(oTree$all_apps_wide), nrow(oTree$survey),
nrow(oTree$Time), nrow(oTree$Chats)))
#> [1] "37 33 366 41"