29 lines
940 B
R
29 lines
940 B
R
# ds <- readr::read_csv(here::here("/Volumes/Data/REDCap/DDV/talos_ddv.csv"))
|
|
|
|
|
|
# Tun first 3 lines of code in 00_master.R
|
|
|
|
# Label attributes are removed then pivoted to long
|
|
df <- purrr::map(X_tbl,\(.x){
|
|
# browser()
|
|
class(.x) <- class(.x)[-1]
|
|
.x
|
|
}) |>
|
|
dplyr::bind_cols() |>
|
|
dplyr::mutate(id=dplyr::row_number()) |>
|
|
dplyr::select(id,dplyr::everything()) |>
|
|
tidyr::pivot_longer(c("pase_0","pase_6"),names_to = "time",values_to = "pase") |>
|
|
dplyr::mutate(time = as.numeric(factor(time))-1)
|
|
|
|
lme4::lmer(formula = pase~age+male_sex+hypertension+diabetes+nihss_c+(1|id),data = df) |>
|
|
gtsummary::tbl_regression()
|
|
|
|
summary(df$male_sex)
|
|
|
|
df |>
|
|
dplyr::mutate(dplyr::across(c("id","hypertension","diabetes","time"),\(.x)factor(.x)),
|
|
female=male_sex==1) |>
|
|
(\(.x){
|
|
mmrm::mmrm(formula = pase~age+female+hypertension+diabetes+nihss_c+us(time|id),data=.x)
|
|
})() |> gtsummary::tbl_regression()
|
|
|