## ----packages, message=FALSE-------------------------------------------------- if (!requireNamespace("lexopsdata", quietly = TRUE)) { knitr::opts_chunk$set(eval = FALSE) } else { library(lexopsdata) } library(readr) library(dplyr) library(ggplot2) library(LexOPS) ## ----hidden-setup, include=FALSE---------------------------------------------- theme_set(theme_minimal()) set.seed(1) ## ----import-data-1------------------------------------------------------------ sensorimotor <- read_csv("https://osf.io/48wsc/download") ## ----check-data-1, eval = FALSE----------------------------------------------- # sensorimotor |> # head(5) ## ----check-data-1-kable, echo = FALSE----------------------------------------- sensorimotor |> head(5) |> knitr::kable() ## ----import-data-2------------------------------------------------------------ humour <- read_csv("https://raw.githubusercontent.com/tomasengelthaler/HumorNorms/master/humor_dataset.csv") ## ----check-data-2, eval = FALSE----------------------------------------------- # humour |> # head(5) ## ----check-data-2-kable, echo = FALSE----------------------------------------- humour |> head(5) |> knitr::kable() ## ----join-data-1-------------------------------------------------------------- sensorimotor <- sensorimotor |> rename(word = Word) |> mutate(word = tolower(word)) ## ----join-data-2-------------------------------------------------------------- humour <- humour |> rename_at(vars(-word), ~paste("Humour", .x, sep=".")) ## ----join-data-3-------------------------------------------------------------- sens_hum <- full_join(sensorimotor, humour, by="word") |> left_join(lexops, by=c("word"="string")) ## ----plot-joined-data, fig.show='hold', message=FALSE, warning=FALSE---------- sens_hum |> ggplot(aes(Visual.mean)) + geom_density() sens_hum |> ggplot(aes(Humour.mean)) + geom_density() sens_hum |> ggplot(aes(Visual.mean, Humour.mean)) + geom_point(alpha=0.5) ## ----generate----------------------------------------------------------------- stim <- sens_hum |> set_options(id_col = "word") |> split_by(Visual.mean, 0:2 ~ 3.5:5) |> split_by(Humour.mean, 2:2.5 ~ 3:5) |> control_for(Length, 0:0) |> control_for(Zipf.SUBTLEX_UK, -0.2:0.2) |> generate(25) ## ----plot-design, fig.width=7, fig.height=5----------------------------------- plot_design(stim) ## ----print, eval = FALSE------------------------------------------------------ # print(stim) ## ----print-kable, echo = FALSE------------------------------------------------ knitr::kable(stim) ## ----cite-design, eval=FALSE-------------------------------------------------- # cite_design(stim) ## ----cite-design-kable, echo=FALSE-------------------------------------------- cite_design(stim) |> knitr::kable()