createRandomisationDoc: Create block randomisation list documents

Description Usage Arguments Value See Also Examples

Description

Create block randomisation list documents in three possible formats: HTML, PDF (requires LaTeX) and Microsoft Word

Usage

1
2
3
4
5
createRandomisationDoc(patients, strataVars, treatments, header = list(title =
  "Randomisierungsliste zur Studie: title", author = "author", date =
  Sys.Date()), format = c("html", "word", "pdf"), newpage = FALSE,
  file.rmd = system.file("extdata", "randomList.Rmd", package = "blockrand2"),
  outdir = file.path(tempdir(), "blockrand2"))

Arguments

patients

data frame containing the patient's data as returned by createTestdata

strataVars

List of strata variables, each of which is defined in the form of a vector of possible (character) values.

treatments

named vector of character defining the possible treatments. The names are used as acronyms, the values as the full treatment names

header

list with elements title, author, date defining the values to be used in the title, author and date field, respectively, in the header of the document

format

vector of elements from c("html", "word", "pdf") defining the types of documents to be created

newpage

if TRUE and "pdf" is in format each stratum will appear on its own page in the created PDF document

file.rmd

full path to the RMarkdown file that is rendered to create the randomisation list documents. By default the file randomList.Rmd in the subfolder extdata of the package installation directory (returned by system.path(package = "blockrand2") is used. You may want to make a copy of this file, modify it and set file.rmd to the path of that new file to override the appearence of the created output.

outdir

full path to the output directory to which the created document files are written. By default the files are written to a subfolder blockrand2 in the current R session's temporary directory

Value

list containing the full paths to the created files as values and the file extensions (html, docx, pdf) as element names

See Also

https://github.com/hsonne/blockrand2 (provides a short tutorial in the README file)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## Not run: 

# Define title of the study, the author and the date
header <- list(
  title = "Randomisation lists for the study: *Jokes against craziness*",
  author = "Hauke Sonnenberg",
  date = "2016-08-27"
)

# Define stratum variables
strataVars <- list(
  sex = c("male", "female"),
  crazyness = c("weak", "medium", "strong")
)

# Define the treatments
treatments <- c(
  joke = "Tell funny jokes",
  nojoke = "Keep serious!"
)

# Create some patient's testdata using the stratum levels
patients <- createTestdata(strataVars, 40)

# Create the randomisation list documents. We store the paths to the created
# files that are returned invisibly by createRandomisationDoc() in a variable
files <- createRandomisationDoc(
  patients = patients,
  strataVars = strataVars,
  treatments = treatments,
  header = header,
  newpage = TRUE
)

# Show the paths of the created files
files

# Open the html file in the default browser
browseURL(files$html)

# Open the pdf file in the default PDF viewer
system(paste(getOption("pdfviewer"), files$pdf))

## End(Not run)

hsonne/blockrand2 documentation built on May 17, 2019, 6:16 p.m.