# The examples use a slightly modified version of the official oTree
# sample codes.
# Make a codebook and resort the apps
combined_codebook <- codebook(
path = system.file("extdata/ocode_new", package = "gmoTree"),
output = "list",
fsource = "init",
doc_info = FALSE)
# Show the structure of the codebook
str(combined_codebook, 1)
str(combined_codebook$bargaining$Player, 1)
# Make a codebook with only the "bargaining" app
combined_codebook <- codebook(
path = system.file("extdata/ocode_new", package = "gmoTree"),
output = "list",
fsource = "init",
app = "bargaining",
doc_info = FALSE)
# Show the structure of the codebook
str(combined_codebook, 1)
str(combined_codebook$bargaining$Player, 1)
# Make a codebook with all but the "bargaining" app
combined_codebook <- codebook(
path = system.file("extdata/ocode_new", package = "gmoTree"),
output = "list",
fsource = "init",
app_rm = "bargaining",
doc_info = FALSE)
# Show the structure of the codebook
str(combined_codebook, 1)
str(combined_codebook$bargaining$Player, 1)
# Use oTree code in 3.x format
combined_codebook <- codebook(
path = system.file("extdata/ocode_z", package = "gmoTree"),
fsource = "model",
output = "list",
doc_info = FALSE)
# Show the structure of the codebook
str(combined_codebook, 1)
# Show information on missing documentation or complex code
combined_codebook <- codebook(
path = system.file("extdata/ocode_new", package = "gmoTree"),
fsource = "init",
output = "list",
app_rm = "bargaining",
doc_info = TRUE)
if (FALSE) {
# Create a codebook PDF with authors' names and todays' date
codebook(
path = system.file("extdata/ocode_z", package = "gmoTree"),
fsource = "init",
doc_info = FALSE,
output = "file",
output_format = "pdf_document",
date = "today",
title = "My Codebook",
subtitle = "codebook created with gmoTree",
params = list(author = c("Max Mustermann", "John Doe"))
)
# Create a codebook PDF and save it in a subfolder of the
# current folder:
# "C:/Users/username/folder/R_analyses/cb/cb.pdf"
getwd() # "C:/Users/username/folder/R_analyses"
dir.create("cb")
combined_codebook <- gmoTree::codebook(
path = "C:/Users/username/folder/R_analyses/oTree",
fsource = "models",
output = "both",
output_file = "cb/cb.pdf",
output_format = "pdf_document")
# You can also omit *.pdf after the file name
combined_codebook <- gmoTree::codebook(
path = "C:/Users/username/folder/R_analyses/oTree",
fsource = "models",
output = "both",
output_file = "cb/cb",
output_format = "pdf_document")
}
Run the code above in your browser using DataLab