Load Packages
haven
# Check if haven is already installed and if it is, load it.
if (!require(haven)){
# If it's not intalled, then tell R to install it.
install.packages("haven", dependencies = TRUE)
# Once it's installed, tell R to load it.
library(haven)
}
tidyverse
if (!require(tidyverse)){
install.packages("tidyverse", dependencies = TRUE)
library(tidyverse)
}
Import data
dataset <- read_sav("https://osf.io/download/kd4ej/")
Codebook
#First select the variables you'd like to summarize
dataset %>%
select (CoinFlip, FFM_1, Potter15) -> exampleDF
#Then print them with this command
print(dfSummary(exampleDF, graph.magnif = .75), method = 'render')
Warning: unable to open connection to X11 display ''
Data Frame Summary
exampleDF
Dimensions: 122 x 3
Duplicates: 84
| No |
Variable |
Label |
Stats / Values |
Freqs (% of Valid) |
Graph |
Valid |
Missing |
| 1 |
CoinFlip
[haven_labelled, vctrs_vctr, double] |
Flip a coin. Is it heads or tails? |
|
|
 |
118
(96.7%) |
4
(3.3%) |
| 2 |
FFM_1
[haven_labelled, vctrs_vctr, double] |
I see Myself as Someone Who..... - Is
talkative |
| Mean (sd) : 3.5 (1.2) | | min ≤ med ≤ max: | | 1 ≤ 4 ≤ 5 | | IQR (CV) : 1 (0.3) |
|
| 1 | : | 7 | ( | 7.1% | ) | | 2 | : | 17 | ( | 17.2% | ) | | 3 | : | 14 | ( | 14.1% | ) | | 4 | : | 40 | ( | 40.4% | ) | | 5 | : | 21 | ( | 21.2% | ) |
|
 |
99
(81.1%) |
23
(18.9%) |
| 3 |
Potter15
[haven_labelled, vctrs_vctr, double] |
Which of the following would you most
hate people to call you? |
| Mean (sd) : 2.6 (1) | | min ≤ med ≤ max: | | 1 ≤ 2 ≤ 4 | | IQR (CV) : 2 (0.4) |
|
| 1 | : | 15 | ( | 15.0% | ) | | 2 | : | 38 | ( | 38.0% | ) | | 3 | : | 20 | ( | 20.0% | ) | | 4 | : | 27 | ( | 27.0% | ) |
|
 |
100
(82.0%) |
22
(18.0%) |
Generated by summarytools 1.0.1 (R version 4.4.1)
2024-07-17
#First select the variables you'd like to summarize
dataset %>%
select (CoinFlip, FFM_5, Potter17) -> exampleDF
#Then print them with this command
print(dfSummary(exampleDF, graph.magnif = .75), method = 'render')
Warning: unable to open connection to X11 display ''
Data Frame Summary
exampleDF
Dimensions: 122 x 3
Duplicates: 87
| No |
Variable |
Label |
Stats / Values |
Freqs (% of Valid) |
Graph |
Valid |
Missing |
| 1 |
CoinFlip
[haven_labelled, vctrs_vctr, double] |
Flip a coin. Is it heads or tails? |
|
|
 |
118
(96.7%) |
4
(3.3%) |
| 2 |
FFM_5
[haven_labelled, vctrs_vctr, double] |
I see Myself as Someone Who..... - Is
original, comes up with new ideas |
| Mean (sd) : 3.8 (0.8) | | min ≤ med ≤ max: | | 2 ≤ 4 ≤ 5 | | IQR (CV) : 1 (0.2) |
|
| 2 | : | 6 | ( | 6.2% | ) | | 3 | : | 26 | ( | 26.8% | ) | | 4 | : | 50 | ( | 51.5% | ) | | 5 | : | 15 | ( | 15.5% | ) |
|
 |
97
(79.5%) |
25
(20.5%) |
| 3 |
Potter17
[haven_labelled, vctrs_vctr, double] |
How would you like to be known to
history? |
| Mean (sd) : 2.2 (1) | | min ≤ med ≤ max: | | 1 ≤ 2 ≤ 4 | | IQR (CV) : 2 (0.5) |
|
| 1 | : | 29 | ( | 28.7% | ) | | 2 | : | 35 | ( | 34.7% | ) | | 3 | : | 22 | ( | 21.8% | ) | | 4 | : | 15 | ( | 14.9% | ) |
|
 |
101
(82.8%) |
21
(17.2%) |
Generated by summarytools 1.0.1 (R version 4.4.1)
2024-07-17
#First select the variables you'd like to summarize
dataset %>%
select (CoinFlip, FFM_10, Potter13) -> exampleDF
#Then print them with this command
print(dfSummary(exampleDF, graph.magnif = .75), method = 'render')
Warning: unable to open connection to X11 display ''
Data Frame Summary
exampleDF
Dimensions: 122 x 3
Duplicates: 91
| No |
Variable |
Label |
Stats / Values |
Freqs (% of Valid) |
Graph |
Valid |
Missing |
| 1 |
CoinFlip
[haven_labelled, vctrs_vctr, double] |
Flip a coin. Is it heads or tails? |
|
|
 |
118
(96.7%) |
4
(3.3%) |
| 2 |
FFM_10
[haven_labelled, vctrs_vctr, double] |
I see Myself as Someone Who..... - Is
curious about many different things |
| Mean (sd) : 4.2 (0.9) | | min ≤ med ≤ max: | | 1 ≤ 4 ≤ 5 | | IQR (CV) : 1 (0.2) |
|
| 1 | : | 1 | ( | 1.0% | ) | | 2 | : | 5 | ( | 5.1% | ) | | 3 | : | 11 | ( | 11.2% | ) | | 4 | : | 40 | ( | 40.8% | ) | | 5 | : | 41 | ( | 41.8% | ) |
|
 |
98
(80.3%) |
24
(19.7%) |
| 3 |
Potter13
[haven_labelled, vctrs_vctr, double] |
Four goblets are placed before you.
Which would you choose to drink? |
| Mean (sd) : 2.4 (1) | | min ≤ med ≤ max: | | 1 ≤ 2 ≤ 4 | | IQR (CV) : 1 (0.4) |
|
| 1 | : | 13 | ( | 13.0% | ) | | 2 | : | 52 | ( | 52.0% | ) | | 3 | : | 15 | ( | 15.0% | ) | | 4 | : | 20 | ( | 20.0% | ) |
|
 |
100
(82.0%) |
22
(18.0%) |
Generated by summarytools 1.0.1 (R version 4.4.1)
2024-07-17
LS0tCnRpdGxlOiAiTGVhcm5SIE5vdGVib29rIC0gQ3JlYXRlIE5vdGVib29rIgpvdXRwdXQ6CiAgaHRtbF9ub3RlYm9vazoKICAgIFRoZW1lOiBzcGFjZWxhYgogICAgdG9jOiB5ZXMKICAgIHRvY19mbG9hdDogeWVzCi0tLQoKIyBMb2FkIFBhY2thZ2VzIHsudGFic2V0fQoKIyMgaGF2ZW4KIApgYGB7cn0KIyBDaGVjayBpZiBoYXZlbiBpcyBhbHJlYWR5IGluc3RhbGxlZCBhbmQgaWYgaXQgaXMsIGxvYWQgaXQuCmlmICghcmVxdWlyZShoYXZlbikpewogICMgSWYgaXQncyBub3QgaW50YWxsZWQsIHRoZW4gdGVsbCBSIHRvIGluc3RhbGwgaXQuCiAgaW5zdGFsbC5wYWNrYWdlcygiaGF2ZW4iLCBkZXBlbmRlbmNpZXMgPSBU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