library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3 ✓ purrr 0.3.4
## ✓ tibble 3.1.2 ✓ dplyr 1.0.6
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(flextable)
##
## Dołączanie pakietu: 'flextable'
## Następujący obiekt został zakryty z 'package:purrr':
##
## compose
library(lubridate)
##
## Dołączanie pakietu: 'lubridate'
## Następujące obiekty zostały zakryte z 'package:base':
##
## date, intersect, setdiff, union
options(digits = 3)
data <- read_csv("results-survey844761.csv")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_double(),
## submitdate = col_datetime(format = ""),
## startlanguage = col_character(),
## startdate = col_datetime(format = ""),
## datestamp = col_datetime(format = ""),
## ipaddr = col_character(),
## refurl = col_logical(),
## Inst = col_logical(),
## `WX2XNXT16X2X2[Satz]` = col_character(),
## `JX2XNXT3X1X2[Satz]` = col_character(),
## `WX1XNXT21X2X2[Satz]` = col_character(),
## `NX2XNXT4X1X2[Satz]` = col_character(),
## `JX1XNXT7X2X1[Satz]` = col_character(),
## `WX0XPXT5X1X1[Satz]` = col_character(),
## `WX1XPXT6X1X1[Satz]` = col_character(),
## `JX1XPXT7X1X2[Satz]` = col_character(),
## `NX1XPXT20X1X1[Satz]` = col_character(),
## `JX0XPXT3X1X1[Satz]` = col_character(),
## groupTime25375 = col_logical()
## )
## ℹ Use `spec()` for the full column specifications.
data_long <- pivot_longer(data, cols = ends_with("[Satz]"), names_to = "sentence", values_to = "score")
data_long$score <- recode(data_long$score,
`min2` = -2,
`min1` = -1,
`0` = 0,
`plus1` = 1,
`plus2` = 2,
)
data_long <- data_long %>% rowwise() %>% mutate(popr = str_split(sentence, "X", simplify = T)[3])
data_long %>% group_by(popr, sentence) %>% summarise(M = mean(score), SD = sd(score)) %>% arrange(M) %>% flextable()
## `summarise()` has grouped output by 'popr'. You can override using the `.groups` argument.
popr | sentence | M | SD |
N | JX1XNXT7X2X1[Satz] | -1.188 | 1.33 |
N | JX2XNXT3X1X2[Satz] | -1.125 | 1.26 |
N | WX1XNXT21X2X2[Satz] | -0.938 | 1.34 |
N | WX2XNXT16X2X2[Satz] | -0.875 | 1.54 |
N | NX2XNXT4X1X2[Satz] | 0.188 | 1.38 |
P | JX0XPXT3X1X1[Satz] | 0.438 | 1.31 |
P | JX1XPXT7X1X2[Satz] | 1.000 | 1.55 |
P | NX1XPXT20X1X1[Satz] | 1.125 | 1.45 |
P | WX0XPXT5X1X1[Satz] | 1.125 | 1.26 |
P | WX1XPXT6X1X1[Satz] | 1.250 | 1.24 |
data$dur <- data$submitdate - data$startdate
data %>% summarize(M = mean(dur), SD = sd(dur)) %>% flextable()
M | SD |
145 secs | 67.6 |