D4TAlink.light - Quick start
Grégoire Thomas
October 04, 2023
- Load D4TAlink.light
if (!require("D4TAlink.light", quietly = TRUE)) install.packages("D4TAlink.light")
library(D4TAlink.light)
- Parametrise
setTaskAuthor("Doe Johns")
setTaskSponsor("myClient")
setTaskRoot("~/myDataRepository", dirCreate = TRUE)
- 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")
- List the tasks in repository
- Load a task from the repository
mytask <- loadTask(project = "DiseaseABC",
package = "myStudy",
taskname = "2022-09-05_mySecondAnalysis")
- 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")
- Load data from a task
e <- readBinary(mytask, "myTables")
- 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)
- Add R markdown file from template to a task
rmdfile <- initTaskRmd(mytask)
print(rmdfile)
- 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)
- List content of task
print(listTaskFiles(mytask))