library(rankinPlot)

?rankinPlot::grottaBar

dta<-read.csv("/Volumes/Data/exercise/source/background.csv",colClasses = "character", na.strings = c("NA","","unknown"))[,c("rtreat","mrs_0","mrs_1","mrs_6","hypertension","diabetes","civil")]

df <- dta |> select(c("rtreat","mrs_0","mrs_1","mrs_6")) |> pivot_longer(cols = -rtreat)

x<-table(mRS=df$value,
      Group=df$rtreat,
      Time = df$name)

grottaBar(x,groupName="Group",
          scoreName = "mRS",
          strataName="Time",
          colourScheme ="custom"
) +
  scale_fill_viridis_d(direction=-1)

dta |> select(-c("mrs_0","mrs_1")) |> generic_stroke(group = "rtreat", score = "mrs_6", variables = c("hypertension","diabetes","civil"))

library(stRoke)
cc<-dta[complete.cases(dta),]
talos <- cc[sample(1:nrow(cc),200),] |> select(-mrs_0)

save(talos,file="talos.rda")
