transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
37
TALOS data workflow/pase calculation.R
Normal file
37
TALOS data workflow/pase calculation.R
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
library(tidyverse)
|
||||
|
||||
token=keyring::key_get("talos_redcap_api")
|
||||
# keyring::key_set("talos_redcap_api")
|
||||
|
||||
# REDCapR::redcap_variables(redcap_uri = "https://redcap.au.dk/api/",token = token)
|
||||
# inst <- REDCapR::redcap_instruments(redcap_uri = "https://redcap.au.dk/api/",token = token)
|
||||
|
||||
# REDCapR::redcap_read(redcap_uri = "https://redcap.au.dk/api/",token = token)
|
||||
|
||||
pase_raw <- REDCapR::redcap_read(redcap_uri = "https://redcap.au.dk/api/",token = token,fields = "record_id",forms = c("pase_0"))
|
||||
|
||||
## Selecting relevant variables only
|
||||
## "(a)x_" variables are notes and excluded.
|
||||
## "12_" is not used for scoring
|
||||
pase_sel <- pase_raw[["data"]] |> select("record_id",
|
||||
contains("_pase"),
|
||||
-contains("x_"),
|
||||
-contains("12_"))
|
||||
|
||||
## Last subset to have relevant cleaned PASE data only
|
||||
pase <- pase_sel[,c(3:23)]
|
||||
|
||||
## Function
|
||||
source("TALOS data workflow/pase_calc.R")
|
||||
|
||||
|
||||
|
||||
|
||||
## No work adjustment (older method)
|
||||
summary((pase |> pase_calc(adjust_work = FALSE))[,13])
|
||||
## With work adjustment (newer method)
|
||||
summary((scores <- pase |> pase_calc())[,13])
|
||||
|
||||
# pase <- pase[sample(seq_len(nrow(pase)),size = 200),]
|
||||
# names(pase) <- sub("_0","",sub("talos","sample", names(pase)))
|
||||
# saveRDS(pase,"pase.rds")
|
||||
Loading…
Reference in a new issue