Description Usage Arguments Details Value References Examples
Print the participant section for a manuscript from a data.frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
data |
data object for which the demographics should be printed. |
id |
a string, name of the column in |
age |
a string, name of the column in |
gender |
a string, name of the column in |
excl |
a string or a number. A number specifies how many participants have been excluded from |
date |
(optional) a string, either the data collection period (e.g., |
recruitedfrom |
(optional) a string, where were participants recruited? E.g., "Amazon Mechanical Turk" or "Harvard's subject pool". |
collectedat |
(optional) string, where was the data collected? E.g. "online" or Stanford University". |
approvedby |
(optional) string, which ethics board approved the study? E.g., "the Oxford University's ethics comittee" |
compensation |
(optional) a string, either |
gender.label |
(optional) if the values of the gender variable in data are numeric, specify which number represents which gender, e.g. |
date.format |
(optional) if |
currency |
(optional) string, only if the argument |
more |
(optional) list, specifying additional variables to be summarized. See details. |
file |
(optional) string, output file location, can be *.tex or *.txt. |
The argument more
works as follows: You want to print "Mean study duration was ... minutes". Your data contains a variable dur_min
. Specify this: more = list("study duration" = c("time_min", "minutes"))
, the name "study duration"
is the name to be printed, "time_min" is the column name in your data, and "minute"
determines the unit (in singular).
A string with the participant description.
Sutton, R. S., & Barto, A. G. (1998). ReINforcement learnINg: An INtroduction. Cambridge, MA: MIT Press
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | mydata <- data.frame(
id = 1:3,
date = c("01102010-10:30", "02102010-10:30", "03102010-10:30"),
payed = c(10,7,1.56),
age = c(20,22,21),
fem = c("m","f","m"),
dur_min = c(22, 25, 30),
income = c(1200, 1500, 2400))
# Print minimal demographics
participants(mydata, id = "id", age = "age", gender = "fem", excl = 0)
# Result:
# In total three participants completed the study (zero were excluded),
# 2 males and 1 female (67% and 33%, respectively), mean age 21 years
# (med = 21, sd = 1, range 20-22 years).
# Note, this is too little information according to APA.
# Add the date
participants(mydata, id = "id", age = "age", gender = "fem", excl = 0,
date = "date",
date.format = "%d%m%Y") # since date is not un-ambiguous
# Add where the data was collected
participants(mydata, id = "id", age = "age", gender = "fem", excl = 0,
date = "date", date.format = "%d%m%Y",
collectedat = "the University of Basel") # local
participants(mydata, id = "id", age = "age", gender = "fem", excl = 0,
date = "date", date.format = "%d%m%Y", collectedat = "online")
# Add further variables: income
participants(mydata, id = "id", age = "age", gender = "fem", excl = 0,
date = "date", date.format = "%d%m%Y", collectedat = "online",
more = list("income" = c("income", "CHF")))
# Exclude one participant
mydata$exclusion <- c(NA, NA, 'failing attention checks')
participants(mydata, id = "id", age = "age", gender = "fem", excl = "exclusion")
# Save result to file
participants(mydata, id = "id", age = "age", gender = "fem", excl = 0, file = "participants.txt")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.