transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
48
side projects/post_stroke_sleep.R
Normal file
48
side projects/post_stroke_sleep.R
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Setup
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
token=names(suppressWarnings(read.csv("/Users/au301842/pss_redcap_token.csv",colClasses = "character")))
|
||||
uri="https://redcap.au.dk/api/"
|
||||
|
||||
library(REDCapR)
|
||||
library(gtsummary)
|
||||
source("https://raw.githubusercontent.com/agdamsbo/daDoctoR/master/R/dob_extract_cpr_function.R")
|
||||
|
||||
library(lubridate)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Data download
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
dta <- redcap_read_oneshot(
|
||||
redcap_uri = uri,
|
||||
token = token,
|
||||
forms = "baggrund"
|
||||
)$data
|
||||
|
||||
dta<-dta[!is.na(dta$debut),]
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Table 1
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
vars<-c("kon","age","nihss_acute","diagnosis","psg_performed","interview")
|
||||
|
||||
# Mangler tilpassede analyser til NIHSS
|
||||
|
||||
dta[dta$record_id %in% 12:26,] |>
|
||||
tbl_summary(missing = "ifany",
|
||||
include = all_of(vars),
|
||||
missing_text="(Missing)"#,
|
||||
#label = lab_sel(labels_all,tbl1_vars)
|
||||
)|>
|
||||
add_n()|>
|
||||
as_gt() |>
|
||||
# modify with gt functions
|
||||
gt::tab_header("Baseline Characteristics") |>
|
||||
gt::tab_options(
|
||||
table.font.size = "small",
|
||||
data_row.padding = gt::px(1))
|
||||
|
||||
skimr::skim(dta[dta$record_id %in% 12:26,]) |> gt::gt()
|
||||
Loading…
Reference in a new issue