Skip to content

Instantly share code, notes, and snippets.

View DanChaltiel's full-sized avatar

Dan Chaltiel DanChaltiel

View GitHub Profile
library(tidyverse)
dec_labs = c("E = Escalate to the next higher dose",
"S = Stay at the current dose",
"D = De-escalate to the next lower dose",
"DE = De-escalate and eleminate the current and higher doses")
#cf BOIN design
@DanChaltiel
DanChaltiel / blockrand2.R
Last active December 2, 2024 10:15
Extention of [blockrand::blockrand]
#' Extention de [blockrand::blockrand]
#'
#' @param n_arm nombre de patient par bras
#' @param levels vecteur de bras de traitement
#' @param strata liste contenant les facteurs de stratification
#' @param block.sizes tailles de bloc possible (multiple du nombre de bras)
#' @param ... passé à [blockrand::blockrand]
#'
#' @author Dan Chaltiel (30/06/2023)
#' @return une tibble
@DanChaltiel
DanChaltiel / read_nquery.R
Last active March 16, 2022 11:23
Read nQuery file
if(!require(tidyverse) || !require(xml2)){
stop("Packages `tidyverse` and `xml2` are required for read_nquery() to work.\n",
'Please run `install.packages(c("tidyverse", "xml2", "devtools"))` before trying again.')
}
#' Read nQuery files
#'
#' @param file the `.nqt` file
@DanChaltiel
DanChaltiel / pagebreaks.lua
Created December 30, 2019 10:59
An RMarkdown pandoc filter for MS Word docx output
-- Extension ofTarleb's answer on Stackoverflow (https://stackoverflow.com/a/52131435/3888000) to include docx section ends with portrait/landscape orientation changes.
-- Also uses officer package syntax to create sections breaks
local function newpage(format)
if format == 'docx' then
local pagebreak = '<w:p><w:r><w:br w:type="page"/></w:r></w:p>'
return pandoc.RawBlock('openxml', pagebreak)
else
return pandoc.Para{pandoc.Str '\f'}