make_ids {gmoTree} | R Documentation |
Make IDs
Description
Make session IDs and, optionally, group IDs and participant IDs
that span across all data frames created by import_otree
.
Information for these IDs is taken from $all_apps_wide
but can be defined otherwise.
Note: Older versions of oTree may already contain a
variable called session_id in their $Time
data frames.
This variable is overwritten by this function!
Important: Combine duplicate data before running this function!
Usage
make_ids(
oTree,
gmake = FALSE,
pmake = TRUE,
from_app = "all_apps_wide",
from_var = NULL,
sstart = 1L,
gstart = 1L,
pstart = 1L,
emptyrows = NULL,
icw = FALSE
)
Arguments
oTree |
A list of data frames that were created
by |
gmake |
Logical. |
pmake |
Logical. |
from_app |
Character. Name of the data frame from which the session,
group, and participant information should be taken.
All normal app data frames and |
from_var |
Character. Name of the variable from which the group
information should be taken. This argument is only relevant
when |
sstart |
Integer. The number that serves as a starting point for session IDs. |
gstart |
Integer. The number that serves as a starting point for group IDs. |
pstart |
Integer. The number that serves as a starting point for participant IDs. |
emptyrows |
Character. |
icw |
Logical. |
Value
ID variables are made in $all_apps_wide
, all app data frames,
the $Time
data frame, and the $Chats
data frame.
See list of the additional ID variables in $info$additional_variables
.
Examples
# Use package-internal list of oTree data frames
oTree <- gmoTree::oTree
# Make session IDs only
oTree2 <- make_ids(oTree)
# Show new variables
oTree2$all_apps_wide$session_id
# Make session IDs and group IDs
# Not working with this data set because group ID is not the same in all apps
## Not run:
oTree2 <- make_ids(oTree, gmake = TRUE)
# Show new variables
oTree2$all_apps_wide$session_id
oTree2$all_apps_wide$group_id
## End(Not run)
# Get IDs from variable "dictator.1.group.id_in_subsession"
# in the data frame "all_apps_wide"
oTree2 <- make_ids(oTree,
gmake = TRUE,
from_var = "dictator.1.group.id_in_subsession")
# Show new variables
oTree2$all_apps_wide$session_id
oTree2$all_apps_wide$group_id
# Get IDs from another app than all_apps_wide
oTree2 <- make_ids(oTree, gmake = TRUE, from_app = "dictator")
# Show new variables
oTree2$all_apps_wide$session_id
oTree2$all_apps_wide$group_id