knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

System dependency specification file

rfacts has strict system dependencies.

Before you can use rfacts to simulate trials in R, you must specify the paths to all these executable files in a CSV file. You can see an example CSV file at inst/example_paths.csv in the rfacts package source.

path <- system.file("example_paths.csv", package = "rfacts")
writeLines(readLines(path))

Required columns

Connecting rfacts to the system dependencies

To allow rfacts to find the CSV file above, you must set the RFACTS_PATHS environment variable. For a single R session, you can do this with Sys.setenv(RFACTS_PATHS = "path/to/file.csv"). To set RFACTS_PATHS permanently for all future sessions, open your .Renviron file with usethis::edit_r_environ() and add a line with RFACTS_PATHS=path/to/file.csv. Then, restart R so the changes take effect. Verify that you did this correctly by checking the value of the environment variable.

old_rfacts_paths <- Sys.getenv("RFACTS_PATHS")
Sys.setenv(
  RFACTS_PATHS = system.file(
    "example_paths.csv",
    package = "rfacts",
    mustWork = TRUE
  )
)
Sys.getenv("RFACTS_PATHS")

Check the system dependency information with rfacts_paths().

library(rfacts)
rfacts_paths()

Use rfacts_sitrep() to verify that all the executables exist and are indeed executable. This vignette uses toy paths that do not actually exist. In your setup, if exists and is_executable are all TRUE, then your setup is configured correctly.

rfacts_sitrep()
Sys.setenv(RFACTS_PATHS = old_rfacts_paths)
detach("package:rfacts", unload=TRUE)

If you change RFACTS_PATHS, you need to call reset_rfacts_paths() or restart R in order for the changes to take effect.



EliLillyCo/rfacts documentation built on Aug. 21, 2022, 11:54 p.m.