Nothing
## ----packages, message=FALSE--------------------------------------------------
library(dplyr)
library(LexOPS)
## ----hidden-setup, include=FALSE----------------------------------------------
set.seed(1)
## ----simulate-data------------------------------------------------------------
n_sub <- 10000
pool <- tibble(
subj_id = sprintf("s%04d", 1:n_sub),
age = runif(n_sub, 18, 50),
sex = sample(
c("m", "f", NA), n_sub,
replace = TRUE,
prob = c(0.48, 0.48, 0.04)
),
bmi = rnorm(n_sub, 25, 5),
iq = rnorm(n_sub, 100, 15)
)
## ----gen-subj-----------------------------------------------------------------
study_subj <- pool |>
subset(!is.na(sex)) |>
set_options(id_col = "subj_id") |>
split_random(2) |>
control_for(age, -1:1) |>
control_for(sex) |>
control_for(bmi, -0.5:0.5) |>
control_for(iq, -5:5) |>
generate(50)
## ----print-res-1, eval=FALSE--------------------------------------------------
# head(study_subj, 5)
## ----print-res-1-kable, echo=FALSE--------------------------------------------
study_subj |>
head(5) |>
knitr::kable()
## ----print-res-long-1, eval=FALSE---------------------------------------------
# study_subj |>
# long_format() |>
# head(10)
## ----print-res-long-1-kable, echo=FALSE---------------------------------------
study_subj |>
long_format() |>
head(10) |>
knitr::kable()
## ----plot-design, fig.width=6, fig.height=4-----------------------------------
plot_design(study_subj)
## ----count-sex, eval=FALSE----------------------------------------------------
# study_subj |>
# long_format() |>
# count(condition, sex)
## ----count-sex-kable, echo=FALSE----------------------------------------------
study_subj |>
long_format() |>
count(condition, sex) |>
knitr::kable()
## ----plot-sample, fig.width=6, fig.height=4-----------------------------------
plot_sample(study_subj)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.