transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
73
side projects/assignment.R
Normal file
73
side projects/assignment.R
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# Sample data set is generated with rownames and colnames
|
||||
ds <- do.call(cbind,lapply(1:133,function(i){
|
||||
sample(c(1,2,3,4,5,rep(NA,12)),size=17)
|
||||
}))
|
||||
rownames(ds) <- letters[seq_len(nrow(ds))]
|
||||
colnames(ds) <- paste0("sub",seq_len(ncol(ds)))
|
||||
|
||||
# df[as.character(as.matrix(ds))==0] <- 17
|
||||
|
||||
# Clearing NAs and applying the max cost instead
|
||||
# ds[is.na(ds)] <- 17
|
||||
|
||||
# I believe this would actually be the organic data set
|
||||
df <- data.frame("ID"=colnames(ds),t(ds))
|
||||
|
||||
|
||||
|
||||
openxlsx::write.xlsx(df,"assign_sample.xlsx")
|
||||
write.csv(df,"assign_sample.csv",na = "",row.names = FALSE)
|
||||
|
||||
|
||||
|
||||
|
||||
df[as.matrix(df)==0] <- 17
|
||||
|
||||
assigned <- df |>
|
||||
group_assignment(cap_classes = rep(8, 17),excess_space = 1)
|
||||
|
||||
df |> group_assignment()
|
||||
|
||||
|
||||
assigned$`Group assignment`
|
||||
|
||||
assigned$`Cost evaluation` |> assignment_plot(1:5)
|
||||
|
||||
|
||||
|
||||
|
||||
pre_grouped <- data.frame("ID"=sample(df$ID,10),"group"=sample(1:17,10))
|
||||
ds <- df
|
||||
|
||||
assigned <- df |>
|
||||
group_assignment(excess_space = 1.05,
|
||||
pre_assign = pre_grouped)
|
||||
|
||||
lengths(assigned[[1]])
|
||||
|
||||
#
|
||||
# ds <- read.csv("assign_sample.csv")
|
||||
#
|
||||
# ls <- read.csv("assign_sample.csv") |> group_assignment(cap_classes = 8, excess_space = 1)
|
||||
#
|
||||
# ls |> assignment_plot()
|
||||
#
|
||||
# lst <- ls
|
||||
#
|
||||
# "[["(ls,4) |> head(10)
|
||||
|
||||
# View(ls$export)
|
||||
#
|
||||
# pre_grouped <- data.frame("ID"=sample(ds$ID,10),"group"=sample(1:17,10))
|
||||
# write.csv(pre_grouped,"pre_grouped.csv",row.names = FALSE)
|
||||
#
|
||||
# assigned <- ds |>
|
||||
# group_assignment(excess_space = 1.05,
|
||||
# pre_assign = pre_grouped)
|
||||
|
||||
# ls <-
|
||||
# read.csv("assign_sample.csv") |> group_assignment(
|
||||
# cap_classes = 8,
|
||||
# excess_space = 1,
|
||||
# pre_assign = read.csv("pre_grouped.csv")
|
||||
# )
|
||||
12
side projects/ipto_calendar_import.R
Normal file
12
side projects/ipto_calendar_import.R
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
## IPTO import
|
||||
library(readxl)
|
||||
|
||||
# Not possible to link to online file, and so the downloaded file is used.
|
||||
dt<-read_xlsx("/Users/au301842/OneDrive/Research/PhD/Vejledning/IPTO_AGD.xlsx")
|
||||
|
||||
# To-dos
|
||||
|
||||
# - Export to calendar
|
||||
# - Naming according to category
|
||||
# - Dates and duration from file
|
||||
# - Limit import to relevant rows/columns
|
||||
BIN
side projects/jc2023.ods
Normal file
BIN
side projects/jc2023.ods
Normal file
Binary file not shown.
78
side projects/jc_cal.ics
Normal file
78
side projects/jc_cal.ics
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
BEGIN:VCALENDAR
|
||||
PRODID:ATFutures/calendar
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:PUBLISH
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Anne [Claus Simonsen]
|
||||
DTSTART:20230117T090000
|
||||
DTEND:20230117T100000
|
||||
UID:ical-8975bd20-da0d-476e-ad8b-bc93c11992d2
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Camilla [Morten Stilund]
|
||||
DTSTART:20230221T090000
|
||||
DTEND:20230221T100000
|
||||
UID:ical-6fcb55e3-9ebc-40dd-a59e-1c40d89f1ac7
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Andreas [Janne Mortensen]
|
||||
DTSTART:20230321T090000
|
||||
DTEND:20230321T100000
|
||||
UID:ical-3748aed7-6f7a-4eba-8425-88a649ed6a01
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Mette [Claus Simonsen]
|
||||
DTSTART:20230418T090000
|
||||
DTEND:20230418T100000
|
||||
UID:ical-95a5dd9d-60a5-46ee-a635-dd9ee79161e3
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Sigrid [Janne Mortensen]
|
||||
DTSTART:20230523T090000
|
||||
DTEND:20230523T100000
|
||||
UID:ical-40881f9c-cd1b-4356-9915-557f8f89c405
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Anders [Henning Andersen]
|
||||
DTSTART:20230613T090000
|
||||
DTEND:20230613T100000
|
||||
UID:ical-786215da-b996-4136-b6a0-81c17c8a0590
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Sine [Claus Simonsen]
|
||||
DTSTART:20230815T090000
|
||||
DTEND:20230815T100000
|
||||
UID:ical-d97439f6-f519-4199-9ecb-11e45b7acc65
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Helga [Henning Andersen]
|
||||
DTSTART:20230912T090000
|
||||
DTEND:20230912T100000
|
||||
UID:ical-71c1f62e-03e7-46b8-87ca-c915b80a56e1
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Thomas [Claus Simonsen]
|
||||
DTSTART:20231003T090000
|
||||
DTEND:20231003T100000
|
||||
UID:ical-02cd6933-1db7-4be5-aa70-e1655733370e
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Marie [Claus Simonsen]
|
||||
DTSTART:20231031T090000
|
||||
DTEND:20231031T100000
|
||||
UID:ical-9ea63131-b8d9-40a2-b2f6-c1a86721c81d
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Jesper [Henning Andersen]
|
||||
DTSTART:20231121T090000
|
||||
DTEND:20231121T100000
|
||||
UID:ical-17bf89ac-dbd4-4d2e-8da8-e99963f740a1
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Neuro JC: Josefine [Henning Andersen]
|
||||
DTSTART:20231219T090000
|
||||
DTEND:20231219T100000
|
||||
UID:ical-4a14e2ba-9fd3-4c90-b427-2d014aa5d6e7
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
28
side projects/jc_kalender.R
Normal file
28
side projects/jc_kalender.R
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# NOTER
|
||||
#
|
||||
# .ics uploades til git, herefter muligt at abbonere.
|
||||
|
||||
|
||||
source("/Users/au301842/stRoke/R/write_ical.R")
|
||||
|
||||
library(dplyr)
|
||||
|
||||
df <-
|
||||
readODS::read_ods("./side projects/jc2023.ods")
|
||||
|
||||
output <- "./side projects/jc_cal.ics"
|
||||
|
||||
df |> mutate(
|
||||
dato.clean = lubridate::dmy(paste0(
|
||||
`Dato `, "/", format(Sys.Date(), format = "%Y")
|
||||
)),
|
||||
title = paste0("Neuro JC: ", `Ansvarlig `, " [", `Vejleder `, "]"),
|
||||
start = "09:00:00",
|
||||
end = "10:00:00",
|
||||
place = "J119"
|
||||
) |>
|
||||
write_ical(date = "dato.clean") |>
|
||||
calendar::ic_write(file = output)
|
||||
|
||||
|
||||
|
||||
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()
|
||||
1
side projects/treatment_quality.R
Normal file
1
side projects/treatment_quality.R
Normal file
|
|
@ -0,0 +1 @@
|
|||
## treatment_quality
|
||||
Loading…
Reference in a new issue