-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
113 lines (113 loc) · 3.95 KB
/
.Rhistory
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# No need to change anything in this block
library(codebook)
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
error = TRUE,
echo = FALSE,
fig.margin = TRUE,
fig.height = 1.4,
fig.width = 3,
echo=FALSE
)
pander::panderOptions("table.split.table", Inf)
ggplot2::theme_set(ggthemes::theme_tufte(base_family = "sans", ticks = FALSE))
study1 <- fread("../processed/study1.csv")
if (!require(pacman)) install.packages("pacman")
pacman::p_load(data.table, codebook, labelled, sjlabelled, dplyr, ggthemes)
study1 <- fread("../processed/study1.csv")
study1
study1
study1
# No need to change anything in this block
library(codebook)
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
error = TRUE,
echo = FALSE,
fig.margin = TRUE,
fig.height = 1.4,
fig.width = 3,
echo=FALSE
)
pander::panderOptions("table.split.table", Inf)
ggplot2::theme_set(ggthemes::theme_tufte(base_family = "sans", ticks = FALSE))
if (!require(pacman)) install.packages("pacman")
pacman::p_load(data.table, codebook, labelled, sjlabelled, dplyr, ggthemes)
study1 <- fread("../processed/study1.csv")
fa <- c("condition", "gambleid", "samplesizecat", "gambletype")
study1[, c(fa) := lapply(.SD, factor), .SDcols = fa]
setcolorder(study1, c("id", "condition", "trial", "gambleid", "gamblex", "gamblep", "gambletype", "samplesizecat", "samplesize"))
study1
study1
variables_explained
study1$samplesizecat
study1$samplesize
# No need to change anything in this block
library(codebook)
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
error = TRUE,
echo = FALSE,
fig.margin = TRUE,
fig.height = 1.4,
fig.width = 3,
echo=FALSE
)
pander::panderOptions("table.split.table", Inf)
ggplot2::theme_set(ggthemes::theme_tufte(base_family = "sans", ticks = FALSE))
# Preparation
study2 <- fread("../processed/study2.csv")
if (!require(pacman)) install.packages("pacman")
pacman::p_load(data.table, codebook, labelled, sjlabelled, dplyr, ggthemes)
# Preparation
study2 <- fread("../processed/study2.csv")
# fa <- c("condition", "gambleid", "samplesizecat", "gambletype") # already defined for study1
study2[, c(fa) := lapply(.SD, factor), .SDcols = fa]
fa <- c("condition", "gambleid", "samplesizecat", "gambletype")
# fa <- c("condition", "gambleid", "samplesizecat", "gambletype") # already defined for study1
study2[, c(fa) := lapply(.SD, factor), .SDcols = fa]
setcolorder(study2, c("id", "condition", "trial", "gambleid", "gamblex", "gamblep", "gambletype", "samplesizecat", "samplesize"))
study2
study2
knitr::opts_chunk$set(
warning = TRUE, # show warnings during codebook generation
message = TRUE, # show messages during codebook generation
error = TRUE, # do not interrupt codebook generation in case of errors,
# usually makes debugging easier, and sometimes half a codebook
# is better than none
echo = FALSE # don't show the R code
)
ggplot2::theme_set(ggplot2::theme_bw())
pander::panderOptions("table.split.table", Inf)
install.packages("formr")
if (!require(pacman)) install.packages("pacman")
pacman::p_load(data.table, codebook, labelled, sjlabelled, dplyr)
# Preparation
data <- fread("../processed/data.csv")
data
data[, c(income_cat, income_num)
# VAR_LABEL --------------------------------------------------------------------
var_label(data$id) <- "Participant id"
data[, c(income_cat, income_num)]
data[, c(income_num, income_cat)]
data[, c(wealth_num, wealth_cat)]
data$community
data$community
data$community_cat
# No need to change anything in this block
if (!require(pacman)) install.packages("pacman")
study1$samplesize
# Preparation
study1 <- fread("../processed/study1.csv")
fa <- c("condition", "gambleid", "samplesizecat", "gambletype")
pacman::p_load(data.table, codebook, labelled, sjlabelled, dplyr, ggthemes)
# Preparation
study1 <- fread("../processed/study1.csv")
fa <- c("condition", "gambleid", "samplesizecat", "gambletype")
study1[, c(fa) := lapply(.SD, factor), .SDcols = fa]
setcolorder(study1, c("id", "condition", "trial", "gambleid", "gamblex", "gamblep", "gambletype", "samplesizecat", "samplesize"))
study1
study1$samplesize