Author: Grégoire Thomas
Date: 2025-09-10

# D4TAlink.light - Quick start

#### Grégoire Thomas

#### September 10, 2025

1. Load D4TAlink.light

    if (!require("D4TAlink.light", quietly = TRUE)) install.packages("D4TAlink.light")
    library(D4TAlink.light)

2. Parametrise

    setTaskAuthor("Doe Johns")
    setTaskSponsor("myClient")
    setTaskRoot("~/myDataRepository", dirCreate = TRUE)

3. Create two tasks (`package` refers here to a work package)

    task1 <- initTask(project = "DiseaseABC",
                      package = "myStudy",
                      taskname = "2022-09-01_myFirstAnalysis")
    task2 <- initTask(project = "DiseaseABC",
                      package = "myStudy",
                      taskname = "2022-09-05_mySecondAnalysis")

4. List the tasks in repository

    print(listTasks())

5. Load a task from the repository

    mytask <- loadTask(project = "DiseaseABC",
                      package = "myStudy",
                      taskname = "2022-09-05_mySecondAnalysis")

6. Add data to a task

    d <- list(letters = data.frame(a = LETTERS, b = letters, c = 1:length(letters)),
              other = data.frame(a = 1:3, b = 11:13))
    saveBinary(d, mytask, "myTables")

7. Load data from a task

    e  <- readBinary(mytask, "myTables")

8. Add reports to a task

    excelfilename <- saveReportXls(d, mytask, "tables")

    pdffilename <- pdfReport(mytask, "myPlot", dim = c(150, 150)) # 150mm x 150mm
    plot(pi)
    dev.off()

    csvfile <- reportFn(mytask, "someData", "csv")
    p <- data.frame(a = LETTERS, b = letters, c = 1:length(letters))
    write.table(p, csvfile)
    print(csvfile)

9. Add R markdown file from template to a task

    rmdfile <- initTaskRmd(mytask)
    print(rmdfile)

10. Render a task’s R markdown file

    # May require having run 'tinytex::install_tinytex()'
    docfile <- renderTaskRmd(mytask)
    if (require("Biobase", quietly = TRUE)) Biobase::openPDF(docfile)

11. List content of task

    print(listTaskFiles(mytask))