Code
library(tidyverse)
library(gt)
library(gtExtras)
library(readxl)
library(devtools)
library(knitr)
write_bib(file = "packages.bib")
library(tidyverse)
library(gt)
library(gtExtras)
library(readxl)
library(devtools)
library(knitr)
write_bib(file = "packages.bib")
<- read_xlsx("SURVEY_DATA.xlsx")
DATA
<-
DATA %>%
DATA select(-where( ~ all(is.na(.)))) %>%
filter(`teilnahme[teilnahme]` == "Y")
<-
DATA 9:81] %>%
DATA[mutate(NA_CHECK = rowSums(!is.na(.))) %>%
filter(NA_CHECK > 0) %>%
filter(AB7 == 0) # exclude special education schools
<- function(item) {
overview_item
<-
TAB %>%
DATA select({{item}}) %>%
table()
<-
t1 %>%
TAB tibble(1:length(.),.) %>%
rename("answer" = 1, "n" = 2) %>%
mutate(var = if_else(answer == max(answer), "correct",
c("wrong1", "wrong2", "wrong3")[1:length(TAB)])) %>%
t() %>%
as.data.frame() %>%
set_names(slice(., n())) %>%
slice_tail(n = -1) %>%
slice_head(n = -1) %>%
mutate_all(as.numeric) %>%
mutate(total = rowSums(select(., where(is.numeric))), .before = 1) %>%
mutate(list_plot = (correct / total * 100) %>% round(1)) %>%
mutate(across(!c(list_plot), ~
paste0(., "<br>(", (. / total * 100) %>% round(1), "%)"), .names = "{.col}"))
t1 }
<-
knowledge rbind(
c("Epilepsy is ... intellectual impairment",
"...a form of...", NA, "...not a form of..."),
c(
"Giftedness is ... in students like Student E (compared to students without epilepsy)",
"...particularly rare...", "...particularly common...",
"...neither particularly rare nor particularly common..."),
c(
"Learning disabilities are ... in students like Student E (compared to students without epilepsy)",
"...particularly rare...", "...particularly common...",
"...neither particularly rare nor particularly common..."
),c(
"In general, students like Student E have ... potential of aggression
(compared to students without epilepsy)",
"...a higher...", "...a lower...", "...neither a higher nor a lower..."
),c(
"In general, students like Student E have ... level of social skills
(compared to students without epilepsy)",
"...a higher...", "...a lower...", "...neither a higher nor a lower..."
),c(
"Physical activity and physical exertion (e.g., sport and exercise) are ... major
triggers for epileptic seizures in students with epilepsy",
"...considered to be...", NA, "...not considered to be..."
),c(
"In most ball sports (e.g., soccer, basketball, or volleyball), the risk of
injury for students with epilepsy is ... (compared to non-sport activities)",
"...significantly higher...", NA, "...not significantly higher..."
),c(
"Emergency medical treatment is ... if a student has a seizure",
"...always necessary...", NA, "...not always necessary..."
),c(
"During a seizure of a student, an object should ... be placed
between the teeth of the affected student (e.g., rubber bite block)",
"...in any case...", NA, "...under no circumstances..."
), c(
"If a student has difficulty breathing during a seizure,
the mouth should ... be opened with physical force during the seizure",
"...in any case...", NA, "...not..."
),c(
"During a seizure with twitching of the limbs, the affected
student should ... be held down (e.g., by the arms and legs)",
"...in any case...", NA, "...not..."
),c(
"A seizure in a student can ... be stopped by speaking loudly and shaking the student awake",
"...very often...", NA, "...not..."
),c(
"A seizure in a student can ... be stopped by splashing the student with cool water",
"...very often...", NA, "...not..."
),c(
"In the event of a seizure, teachers may ... administer the relevant emergency medication
(liquid to be dripped into the mouth) to a student on their own",
"...under no circumstances...", NA, "...in accordance with the emergency plan..."
)%>%
) as.data.frame() %>%
setNames(c("item", "W1", "W2", "C"))
bind_rows(
overview_item(WA8),
overview_item(WA9),
overview_item(WA10) %>% rename(wrong2 = wrong1),
overview_item(WA11),
overview_item(WA12),
overview_item(WA13),
overview_item(WA14),
overview_item(WA1),
overview_item(WA2),
overview_item(WA3),
overview_item(WA4),
overview_item(WA5),
overview_item(WA6),
overview_item(WA7)
%>%
) relocate(total, wrong1, wrong2, correct, list_plot) %>%
cbind(knowledge, .) %>%
gt() %>%
cols_align("left") %>%
cols_label(
wrong1 = html("<center>(1)</center>wrong"),
wrong2 = html("<center>(2)</center>wrong"),
correct = html("<center>(3)</center>correct"),
W1 = html("(1)<br>wrong"),
W2 = html("(2)<br>wrong"),
C = html("(3)<br>correct"),
list_plot = html("bar plot correct")
%>%
) tab_spanner(label = md("*answers*"), columns = c(wrong1, wrong2, correct)) %>%
tab_spanner(label = md("*answer options*"), columns = c(W1, W2, C)) %>%
gt_plt_bar_pct(
column = list_plot,
scaled = T,
labels = TRUE,
fill = "black",
width = 100,
height = 30,
font_size = "12px"
%>%
) fmt_markdown(columns = -last_col()) %>%
tab_style(style = cell_text(weight = "bold", style = "italic"),
locations = cells_column_labels()) %>%
tab_style(style = cell_text(style = "italic"),
locations = cells_footnotes()) %>%
tab_footnote(
footnote = "Student E = Student with epilepsy"
%>%
) tab_row_group(label = md("*seizure first aid (specifically addressing tonic-clonic seizures)*"), rows = 8:14) %>%
tab_row_group(label = md("*physical activity*"), rows = 6:7) %>%
tab_row_group(label = md("*social integration/behavior*"), rows = 4:5) %>%
tab_row_group(label = md("*learning/instruction*"), rows = 1:3) %>%
tab_options(column_labels.background.color = "gray95",
footnotes.background.color = "gray95") %>%
tab_style(style = cell_fill(color = "gray95"), locations = cells_row_groups(groups = everything())) %>%
tab_options(table.align = "left") %>%
sub_missing(missing_text = "") %>%
cols_width(C ~ pct(14)) %>%
cols_width(W1 ~ pct(14)) %>%
cols_width(W2 ~ pct(14)) %>%
cols_align(align = "center", columns = c("C", "W1", "W2", "list_plot"))
item |
answer options
|
total |
answers
|
bar plot correct | ||||
---|---|---|---|---|---|---|---|---|
(1) wrong |
(2) wrong |
(3) correct |
||||||
learning/instruction | ||||||||
Epilepsy is … intellectual impairment | …a form of… | …not a form of… | 209 (100%) |
4 (1.9%) |
205 (98.1%) |
98.1% | ||
Giftedness is … in students like Student E (compared to students without epilepsy) | …particularly rare… | …particularly common… | …neither particularly rare nor particularly common… | 208 (100%) |
1 (0.5%) |
3 (1.4%) |
204 (98.1%) |
98.1% |
Learning disabilities are … in students like Student E (compared to students without epilepsy) | …particularly rare… | …particularly common… | …neither particularly rare nor particularly common… | 206 (100%) |
7 (3.4%) |
199 (96.6%) |
96.6% | |
social integration/behavior | ||||||||
In general, students like Student E have … potential of aggression (compared to students without epilepsy) | …a higher… | …a lower… | …neither a higher nor a lower… | 207 (100%) |
3 (1.4%) |
1 (0.5%) |
203 (98.1%) |
98.1% |
In general, students like Student E have … level of social skills (compared to students without epilepsy) | …a higher… | …a lower… | …neither a higher nor a lower… | 205 (100%) |
7 (3.4%) |
1 (0.5%) |
197 (96.1%) |
96.1% |
physical activity | ||||||||
Physical activity and physical exertion (e.g., sport and exercise) are … major triggers for epileptic seizures in students with epilepsy | …considered to be… | …not considered to be… | 205 (100%) |
13 (6.3%) |
192 (93.7%) |
93.7% | ||
In most ball sports (e.g., soccer, basketball, or volleyball), the risk of injury for students with epilepsy is … (compared to non-sport activities) | …significantly higher… | …not significantly higher… | 208 (100%) |
22 (10.6%) |
186 (89.4%) |
89.4% | ||
seizure first aid (specifically addressing tonic-clonic seizures) | ||||||||
Emergency medical treatment is … if a student has a seizure | …always necessary… | …not always necessary… | 209 (100%) |
114 (54.5%) |
95 (45.5%) |
45.5% | ||
During a seizure of a student, an object should … be placed between the teeth of the affected student (e.g., rubber bite block) | …in any case… | …under no circumstances… | 206 (100%) |
68 (33%) |
138 (67%) |
67% | ||
If a student has difficulty breathing during a seizure, the mouth should … be opened with physical force during the seizure | …in any case… | …not… | 206 (100%) |
19 (9.2%) |
187 (90.8%) |
90.8% | ||
During a seizure with twitching of the limbs, the affected student should … be held down (e.g., by the arms and legs) | …in any case… | …not… | 208 (100%) |
18 (8.7%) |
190 (91.3%) |
91.3% | ||
A seizure in a student can … be stopped by speaking loudly and shaking the student awake | …very often… | …not… | 207 (100%) |
4 (1.9%) |
203 (98.1%) |
98.1% | ||
A seizure in a student can … be stopped by splashing the student with cool water | …very often… | …not… | 207 (100%) |
10 (4.8%) |
197 (95.2%) |
95.2% | ||
In the event of a seizure, teachers may … administer the relevant emergency medication (liquid to be dripped into the mouth) to a student on their own | …under no circumstances… | …in accordance with the emergency plan… | 209 (100%) |
14 (6.7%) |
195 (93.3%) |
93.3% | ||
Student E = Student with epilepsy |
session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
## setting value
## version R version 4.4.2 (2024-10-31 ucrt)
## os Windows 11 x64 (build 22631)
## system x86_64, mingw32
## ui RTerm
## language (EN)
## collate German_Germany.utf8
## ctype German_Germany.utf8
## tz Europe/Berlin
## date 2024-11-21
## pandoc 3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date (UTC) lib source
## base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.4.0)
## cachem 1.1.0 2024-05-16 [1] CRAN (R 4.4.2)
## cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.4.2)
## cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.2)
## colorspace 2.1-1 2024-07-26 [1] CRAN (R 4.4.2)
## commonmark 1.9.2 2024-10-04 [1] CRAN (R 4.4.2)
## devtools * 2.4.5 2022-10-11 [1] CRAN (R 4.4.2)
## digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.2)
## dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.4.2)
## ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.4.2)
## evaluate 1.0.1 2024-10-10 [1] CRAN (R 4.4.2)
## fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.2)
## fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.2)
## fontawesome 0.5.3 2024-11-16 [1] CRAN (R 4.4.2)
## forcats * 1.0.0 2023-01-29 [1] CRAN (R 4.4.2)
## fs 1.6.5 2024-10-30 [1] CRAN (R 4.4.2)
## generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.2)
## ggplot2 * 3.5.1 2024-04-23 [1] CRAN (R 4.4.2)
## glue 1.8.0 2024-09-30 [1] CRAN (R 4.4.2)
## gt * 0.11.1 2024-10-04 [1] CRAN (R 4.4.2)
## gtable 0.3.6 2024-10-25 [1] CRAN (R 4.4.2)
## gtExtras * 0.5.0 2023-09-15 [1] CRAN (R 4.4.2)
## hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.2)
## htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.2)
## htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.4.2)
## httpuv 1.6.15 2024-03-26 [1] CRAN (R 4.4.2)
## jsonlite 1.8.9 2024-09-20 [1] CRAN (R 4.4.2)
## knitr * 1.49 2024-11-08 [1] CRAN (R 4.4.2)
## later 1.3.2 2023-12-06 [1] CRAN (R 4.4.2)
## lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.2)
## lubridate * 1.9.3 2023-09-27 [1] CRAN (R 4.4.2)
## magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.2)
## markdown 1.13 2024-06-04 [1] CRAN (R 4.4.2)
## memoise 2.0.1 2021-11-26 [1] CRAN (R 4.4.2)
## mime 0.12 2021-09-28 [1] CRAN (R 4.4.0)
## miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.4.2)
## munsell 0.5.1 2024-04-01 [1] CRAN (R 4.4.2)
## paletteer 1.6.0 2024-01-21 [1] CRAN (R 4.4.2)
## pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.2)
## pkgbuild 1.4.5 2024-10-28 [1] CRAN (R 4.4.2)
## pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.2)
## pkgload 1.4.0 2024-06-28 [1] CRAN (R 4.4.2)
## profvis 0.4.0 2024-09-20 [1] CRAN (R 4.4.2)
## promises 1.3.0 2024-04-05 [1] CRAN (R 4.4.2)
## purrr * 1.0.2 2023-08-10 [1] CRAN (R 4.4.2)
## R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.2)
## Rcpp 1.0.13-1 2024-11-02 [1] CRAN (R 4.4.2)
## readr * 2.1.5 2024-01-10 [1] CRAN (R 4.4.2)
## readxl * 1.4.3 2023-07-06 [1] CRAN (R 4.4.2)
## rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.4.2)
## remotes 2.5.0 2024-03-17 [1] CRAN (R 4.4.2)
## rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.2)
## rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.4.2)
## rstudioapi 0.17.1 2024-10-22 [1] CRAN (R 4.4.2)
## sass 0.4.9 2024-03-15 [1] CRAN (R 4.4.2)
## scales 1.3.0 2023-11-28 [1] CRAN (R 4.4.2)
## sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.2)
## shiny 1.9.1 2024-08-01 [1] CRAN (R 4.4.2)
## stringi 1.8.4 2024-05-06 [1] CRAN (R 4.4.0)
## stringr * 1.5.1 2023-11-14 [1] CRAN (R 4.4.2)
## tibble * 3.2.1 2023-03-20 [1] CRAN (R 4.4.2)
## tidyr * 1.3.1 2024-01-24 [1] CRAN (R 4.4.2)
## tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.4.2)
## tidyverse * 2.0.0 2023-02-22 [1] CRAN (R 4.4.2)
## timechange 0.3.0 2024-01-18 [1] CRAN (R 4.4.2)
## tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.2)
## urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.4.2)
## usethis * 3.0.0 2024-07-29 [1] CRAN (R 4.4.1)
## utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.2)
## vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.2)
## withr 3.0.2 2024-10-28 [1] CRAN (R 4.4.2)
## xfun 0.49 2024-10-31 [1] CRAN (R 4.4.2)
## xml2 1.3.6 2023-12-04 [1] CRAN (R 4.4.2)
## xtable 1.8-4 2019-04-21 [1] CRAN (R 4.4.2)
## yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.1)
##
## [1] C:/Users/Pawel Kulawiak/AppData/Local/Programs/R/R-4.4.2/library
##
## ──────────────────────────────────────────────────────────────────────────────