| Title: | GDP - Workflow Management |
|---|---|
| Description: | Tools, methods and processes for the management of analysis workflows. These lightweight solutions facilitate structuring R&D activities. These solutions were developed to comply with Good Documentation Practice (GDP), with ALCOA+ principles as proposed by the U.S. FDA, and with FAIR principles as discussed by Jacobsen et al. (2017) <doi:10.1162/dint_r_00024>. |
| Authors: | Gregoire Thomas [aut, cre]
|
| Maintainer: | Gregoire Thomas <[email protected]> |
| License: | GPL-3 |
| Version: | 2.1.21 |
| Built: | 2026-06-09 07:02:02 UTC |
| Source: | https://bitbucket.org/sq4/d4talink.light |
Create an archive containing the files of a given task.
archiveTask(task, file, overwrite = FALSE, ...)archiveTask(task, file, overwrite = FALSE, ...)
task |
Object of class |
file |
full name of the output zip file |
overwrite |
overwrite the output zip file is it exists |
... |
Arguments passed on to
|
the archive file name invisibly.
Get path of binary directory.
binaryDir(task, subdir = NULL, dirCreate = TRUE)binaryDir(task, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Get path of binary file.
binaryFn(task, type, ext = "rds", subdir = NULL, dirCreate = TRUE)binaryFn(task, type, ext = "rds", subdir = NULL, dirCreate = TRUE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Output R object using function cat.
catReport( x, task, type, ext = "txt", subdir = NULL, dirCreate = TRUE, sep = "\n", eof = "\n", ... )catReport( x, task, type, ext = "txt", subdir = NULL, dirCreate = TRUE, sep = "\n", eof = "\n", ... )
x |
R object to output. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
sep |
separator |
eof |
EOF |
... |
R objects (see ‘Details’ for the types of objects allowed). |
the file name invisibly.
Get env var.
D4getenv(name, desc, quiet = FALSE)D4getenv(name, desc, quiet = FALSE)
name |
name of variable |
desc |
description of variable |
quiet |
suppress error messages, default=FALSE. |
Environment variable.
Arguments used across the functions of the D4TAlink package.
project |
Project name. |
package |
Package name. |
taskname |
Task name. |
author |
Author name, system username by default. |
sponsor |
Sponsor name, default set by |
rootpath |
Path of the task repository, default set by |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
dirType |
Directory type, e.g. 'bin' or 'data' or 'doc'. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
pathgen |
optional function returning a list of paths, currently |
No return value, used for the documentation of the functions of the package.
D4TAlinkTask Documentation of the D4TAlinkTask classThe D4TAlinkTask object is created by the initTask function.
This object is a list containing the task properties:
task name
package name
project name
sponsor name
author name
copyright, by default 'Copyright (c) [sponsor] [year]'
date of the task initialization, formatted as 'year-month-day'
footer for the task, e.g., 'Copyright (c) [sponsor] [year] - CONFIDENTIAL'
string with task version, '0.0' at the initialization
information on R versions and names of loaded/attached dependencies and corresponding versions
There are different functions dedicated for this D4TAlinkTask object:
taskID:Get ID
Not relevant
## Not run: # set D4TAlink's global parameters setTaskAuthor("Doe Johns") setTaskSponsor("mySponsor") # Create data repository setTaskRoot(file.path(tempdir(),"D4TAlink_example001"),dirCreate=TRUE) # Create a task task <- initTask(project="myProject", package="myPackage", taskname=sprintf("%s_myTask",format(Sys.time(),"%Y%m%d"))) # Output a plot to a PDF file file <- pdfReport(task,c("plots",1),dim=c(100,100)) opa <- par()$ask par(ask=FALSE) hist(rnorm(100)) par(ask=opa) dev.off() # View the plot: utils::browseURL(file) # Output tables to an Excel file d <- list(letters=data.frame(a=LETTERS,b=letters,c=1:length(letters)), other=data.frame(a=1:3,b=11:13)) file <- saveReportXls(d,task,"table") utils::browseURL(file) # Save an R object to a binary file saveBinary(d,task,"data") e <- readBinary(task,"data") if(!all(names(e)%in%names(d))) stop("error [1]") # Create and render R markdown file initTaskRmd(task,overwrite=TRUE) file <- renderTaskRmd(task) # requires having run 'tinytex::install_tinytex()' utils::browseURL(file) # Delete new data repository unlink(getTaskRoot(),recursive=TRUE) ## End(Not run)## Not run: # set D4TAlink's global parameters setTaskAuthor("Doe Johns") setTaskSponsor("mySponsor") # Create data repository setTaskRoot(file.path(tempdir(),"D4TAlink_example001"),dirCreate=TRUE) # Create a task task <- initTask(project="myProject", package="myPackage", taskname=sprintf("%s_myTask",format(Sys.time(),"%Y%m%d"))) # Output a plot to a PDF file file <- pdfReport(task,c("plots",1),dim=c(100,100)) opa <- par()$ask par(ask=FALSE) hist(rnorm(100)) par(ask=opa) dev.off() # View the plot: utils::browseURL(file) # Output tables to an Excel file d <- list(letters=data.frame(a=LETTERS,b=letters,c=1:length(letters)), other=data.frame(a=1:3,b=11:13)) file <- saveReportXls(d,task,"table") utils::browseURL(file) # Save an R object to a binary file saveBinary(d,task,"data") e <- readBinary(task,"data") if(!all(names(e)%in%names(d))) stop("error [1]") # Create and render R markdown file initTaskRmd(task,overwrite=TRUE) file <- renderTaskRmd(task) # requires having run 'tinytex::install_tinytex()' utils::browseURL(file) # Delete new data repository unlink(getTaskRoot(),recursive=TRUE) ## End(Not run)
Get path of data source directory.
datasourceDir(task, subdir = NULL, dirCreate = TRUE)datasourceDir(task, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Get path of data source file.
datasourceFn(task, filename, subdir = ".", dirCreate = TRUE)datasourceFn(task, filename, subdir = ".", dirCreate = TRUE)
task |
Object of class |
filename |
name of the input file. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Get path of documentation directory.
docDir(task, subdir = NULL, dirCreate = TRUE)docDir(task, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Get path of documentation file.
docFn(task, type, ext, subdir = NULL, dirCreate = TRUE)docFn(task, type, ext, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Generic function.
DTx(sponsor = getTaskSponsor(), task = NULL)DTx(sponsor = getTaskSponsor(), task = NULL)
sponsor |
Sponsor name, default set by |
task |
Object of class |
NULL.
Replace default task fields in 'docx' file.
formatTaskDocx(task, ifn)formatTaskDocx(task, ifn)
task |
Object of class |
ifn |
input file name. |
the file name invisibly.
Get the name of the task author.
getTaskAuthor(quiet = FALSE)getTaskAuthor(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
The current name of the tasks author.
getTaskAuthor(quiet=TRUE)getTaskAuthor(quiet=TRUE)
Get the encryption key for binary data files.
getTaskEnckey(ask = FALSE)getTaskEnckey(ask = FALSE)
ask |
query encryption key from user, default FALSE. |
The encryption key invisibly.
Get the path of a file.
getTaskFilepath(task, type, ext, dirtype, subdir = NULL, dirCreate = TRUE)getTaskFilepath(task, type, ext, dirtype, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
dirtype |
task directory where file is stored, i.e., 'documentation', 'code', 'data', 'data source' or 'binary data'. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
Full path to file.
Get the paths of the task.
getTaskPaths(task)getTaskPaths(task)
task |
Object of class |
List of task's paths.
Get the path to the Quarto task template.
getTaskQmdTemplate(quiet = FALSE)getTaskQmdTemplate(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
The path to the quarto task template.
Get the path to the Rmd task template.
getTaskRmdTemplate(quiet = FALSE)getTaskRmdTemplate(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
The path to the Rmd task template.
Get the root of the task repository.
getTaskRoot(quiet = FALSE)getTaskRoot(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
Path to the current task root.
getTaskRoot(quiet=TRUE)getTaskRoot(quiet=TRUE)
Get the path to the R script task template.
getTaskRscriptTemplate(quiet = FALSE)getTaskRscriptTemplate(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
The path to the R script task template.
Get the name of the task sponsor.
getTaskSponsor(quiet = FALSE)getTaskSponsor(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
The current name of the tasks sponsor.
getTaskSponsor(quiet=TRUE)getTaskSponsor(quiet=TRUE)
Get repository directory structure.
getTaskStructure(quiet = FALSE)getTaskStructure(quiet = FALSE)
quiet |
suppress error messages, default=FALSE. |
The directory structure function.
During the initialization:
The folder structure for the task is created in the data repository.
The task properties are also saved in rds and json format.
Please note that it is recommended to load packages for your analysis before initializing the task.
initTask( project, package, taskname, sponsor = getTaskSponsor(), author = getTaskAuthor(), dirCreate = TRUE, templateCreate = FALSE, overwrite = FALSE )initTask( project, package, taskname, sponsor = getTaskSponsor(), author = getTaskAuthor(), dirCreate = TRUE, templateCreate = FALSE, overwrite = FALSE )
project |
Project name. |
package |
Package name. |
taskname |
Task name. |
sponsor |
Sponsor name, default set by |
author |
Author name, system username by default. |
dirCreate |
logical, if TRUE (by default) the directory structure for the task is created in the repository. |
templateCreate |
create the prefilled Rmd template for the task, default value: FALSE. |
overwrite |
logical, if TRUE and the task already exists, overwrite its parameters. |
D4TAlinkTask object
Create task template in Quarto format.
initTaskQmd(task, encoding = "unknown", overwrite = FALSE, suffix = NA)initTaskQmd(task, encoding = "unknown", overwrite = FALSE, suffix = NA)
task |
Object of class |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
overwrite |
overwrite Qmd file if exists, default FALSE |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
the file name invisibly.
Create task template in Rmd format.
initTaskRmd(task, encoding = "unknown", overwrite = FALSE, suffix = NA)initTaskRmd(task, encoding = "unknown", overwrite = FALSE, suffix = NA)
task |
Object of class |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
overwrite |
overwrite Rmd file if exists, default FALSE |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
the file name invisibly.
Create task R script.
initTaskRscript(task, overwrite = FALSE, encoding = "unknown", suffix = NA)initTaskRscript(task, overwrite = FALSE, encoding = "unknown", suffix = NA)
task |
Object of class |
overwrite |
overwrite R file if exists, default FALSE |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
the file name invisibly.
JPEG format bitmap files.Graphics devices for JPEG format bitmap files.
jpegReport( task, type, ext = "jpg", subdir = NULL, dirCreate = TRUE, dim = c(500, 500), width = NULL, height = NULL, ... )jpegReport( task, type, ext = "jpg", subdir = NULL, dirCreate = TRUE, dim = c(500, 500), width = NULL, height = NULL, ... )
task |
Object of class |
type |
Should be plotting be done using Windows GDI or cairographics? |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
dim |
device height and width in |
width |
device height in |
height |
device height in |
... |
Arguments passed on to
|
the file name invisibly.
jpeg output file.Get path of jpeg output file.
jpegReportFn(task, type, ext = "jpg", subdir = NULL)jpegReportFn(task, type, ext = "jpg", subdir = NULL)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
File path.
List the files associated to a task.
listTaskFiles(task, full.names = FALSE, which = NULL)listTaskFiles(task, full.names = FALSE, which = NULL)
task |
Object of class |
full.names |
a logical value. If |
which |
list of file types to list. |
array of file names.
List details of all tasks stored in the root directory.
listTasks( project = NULL, package = NULL, sponsor = NULL, rootpath = getTaskRoot() )listTasks( project = NULL, package = NULL, sponsor = NULL, rootpath = getTaskRoot() )
project |
Project name. |
package |
Package name. |
sponsor |
Sponsor name, default set by |
rootpath |
Path of the task repository, default set by |
data.frame with the following information for tasks "sponsor", "project", "package", "task".
Load a task.
loadTask( project, package, taskname, sponsor = getTaskSponsor(), author = getTaskAuthor(), quiet = FALSE )loadTask( project, package, taskname, sponsor = getTaskSponsor(), author = getTaskAuthor(), quiet = FALSE )
project |
Project name. |
package |
Package name. |
taskname |
Task name. |
sponsor |
Sponsor name, default set by |
author |
Author name, system username by default. |
quiet |
issue warning if file does not exists. |
Object of class D4TAlinkTask or NULL if the task does not exists.
The paths are: datasrc: [ROOT]/[sponsor]/[project]/[package]/raw/datasource data: [ROOT]/[sponsor]/[project]/[package]/output/[taskname] bin: [ROOT]/[sponsor]/[project]/[package]/output/[taskname]/bin code: [ROOT]/[sponsor]/[project]/[package]/progs doc: [ROOT]/[sponsor]/[project]/[package]/docs log: [ROOT]/[sponsor]/[project]/[package]/output/log
pathsDefault(project, package, taskname, sponsor)pathsDefault(project, package, taskname, sponsor)
project |
Project name. |
package |
Package name. |
taskname |
Task name. |
sponsor |
Sponsor name, default set by |
a list of file paths
The paths are: datasrc: [ROOT]/[sponsor]/[project]/[package]/raw/datasource data: [ROOT]/[sponsor]/[project]/[package]/output/adhoc/[taskname] bin: [ROOT]/[sponsor]/[project]/[package]/output/adhoc/[taskname]/bin code: [ROOT]/[sponsor]/[project]/[package]/progs doc: [ROOT]/[sponsor]/[project]/[package]/docs log: [ROOT]/[sponsor]/[project]/[package]/output/log
pathsGLPG(project, package, taskname, sponsor)pathsGLPG(project, package, taskname, sponsor)
project |
Project name. |
package |
Package name. |
taskname |
Task name. |
sponsor |
Sponsor name, default set by |
a list of file paths
The paths are: datasrc: [ROOT]/[sponsor]/PMS_data/[project]/[package]/datasource data: [ROOT]/[sponsor]/PMS_data/[project]/[package]/[taskname] bin: [ROOT]/[sponsor]/PMS_data/[project]/[package]/[taskname]/bin code: [ROOT]/[sponsor]/PMS_code/[project]/[package]/R doc: [ROOT]/[sponsor]/PMS_documentation/[project]/[package]/[taskname] log: [ROOT]/[sponsor]/PMS_data/[project]/[package]/[taskname]/log
pathsPMS(project, package, taskname, sponsor)pathsPMS(project, package, taskname, sponsor)
project |
Project name. |
package |
Package name. |
taskname |
Task name. |
sponsor |
Sponsor name, default set by |
a list of file paths
pdf format bitmap files.Graphics devices for pdf format bitmap files.
pdfReport( task, type, ext = "pdf", subdir = NULL, dirCreate = TRUE, title = NA, file = NA, dim = c(297, 210), height = NULL, width = NULL, landscape = NULL, ... )pdfReport( task, type, ext = "pdf", subdir = NULL, dirCreate = TRUE, title = NA, file = NA, dim = c(297, 210), height = NULL, width = NULL, landscape = NULL, ... )
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
title |
title string to embed as the ‘/Title’ field in the
document metadata. Defaults to |
file |
a character string giving the file path. See the section ‘File specifications’ for further details. |
dim |
device height and width in |
height |
device height in |
width |
device height in |
landscape |
if defined, orientation of the document. |
... |
Arguments passed on to
|
the file name invisibly.
pdf output file.Get path of pdf output file.
pdfReportFn(task, type, ext = "pdf", subdir = NULL)pdfReportFn(task, type, ext = "pdf", subdir = NULL)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
File path.
PNG format bitmap files.Graphics devices for PNG format bitmap files.
pngReport( task, type, ext = "png", subdir = NULL, dirCreate = TRUE, dim = c(500, 500), width = NULL, height = NULL, ... )pngReport( task, type, ext = "png", subdir = NULL, dirCreate = TRUE, dim = c(500, 500), width = NULL, height = NULL, ... )
task |
Object of class |
type |
Should be plotting be done using Windows GDI or cairographics? |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
dim |
device height and width in |
width |
device height in |
height |
device height in |
... |
Arguments passed on to
|
the file name invisibly.
png output file.Get path of png output file.
pngReportFn(task, type, ext = "png", subdir = NULL)pngReportFn(task, type, ext = "png", subdir = NULL)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
File path.
Get path of scripts directory.
progDir(task, subdir = NULL, dirCreate = TRUE)progDir(task, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Get path of R script file name.
qmdFn(task, suffix = NA)qmdFn(task, suffix = NA)
task |
Object of class |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
File path.
saveSQLite.Load data frame by querying an SQLite database.
This function executes a SQL query on an SQLite database file created with saveSQLite.
querySQLite(query, task, type, subdir = NULL, dirCreate = FALSE, conn = NULL)querySQLite(query, task, type, subdir = NULL, dirCreate = FALSE, conn = NULL)
query |
SQL query to execute. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
conn |
SQLite connection object (optional). |
Data frame with query results.
Restore R object from binary file.
readBinary( task, type, subdir = NULL, dirCreate = FALSE, ask = FALSE, quiet = FALSE, password = NULL )readBinary( task, type, subdir = NULL, dirCreate = FALSE, ask = FALSE, quiet = FALSE, password = NULL )
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
ask |
query encryption key from user, default FALSE. |
quiet |
issue warning if file does not exists. |
password |
encryption password, default NULL |
Object stored in binary file, or NULL if file does not exist.
Restore R data.frame from Apache Arrow feather file.
readFeather(task, type, subdir = NULL, dirCreate = FALSE, quiet = FALSE)readFeather(task, type, subdir = NULL, dirCreate = FALSE, quiet = FALSE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
quiet |
issue warning if file does not exists. |
Object stored in Apache Arrow feather file, or NULL if file does not exist.
Restore R data.frame from a Python pickle file.
readPickle(task, type, subdir = NULL, dirCreate = FALSE, quiet = FALSE)readPickle(task, type, subdir = NULL, dirCreate = FALSE, quiet = FALSE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
quiet |
issue warning if file does not exists. |
Object stored in Apache Arrow feather file, or NULL if file does not exist.
Read JSON data into R object.
readReportJSON(task, type, ext = "json", subdir = NULL, dirCreate = FALSE)readReportJSON(task, type, ext = "json", subdir = NULL, dirCreate = FALSE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
the data read, or NULL if the file does not exist.
scan.Read data into vector or list using function scan.
readReportTable(task, type, ext = "csv", subdir = NULL, dirCreate = FALSE, ...)readReportTable(task, type, ext = "csv", subdir = NULL, dirCreate = FALSE, ...)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
... |
Arguments passed on to
|
the data read, or NULL if the file does not exist.
saveSQLite.Load data frame from SQLite.
This function reads a data frame from an SQLite database file created with saveSQLite.
readSQLite( task, type, subdir = NULL, dirCreate = FALSE, tableName = "data", n = NULL, offset = 0 )readSQLite( task, type, subdir = NULL, dirCreate = FALSE, tableName = "data", n = NULL, offset = 0 )
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
tableName |
name of the table in the SQLite database. |
n |
number of rows to read (if NULL, all rows are read). |
offset |
number of rows to skip before reading (default is 0). |
Data frame with requested table.
The template of the task is rendered towards pdf or html in the documentation directory of the specified task. Note that on windows, Gnu zip may be required. The path to the executable must be added to the environment variables.
renderTaskQmd(task, output_format = "docx", debug = FALSE, suffix = NA, ...)renderTaskQmd(task, output_format = "docx", debug = FALSE, suffix = NA, ...)
task |
Object of class |
output_format |
Target output format (defaults to |
debug |
if TRUE execute in the global environment. |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
... |
Arguments passed on to
|
the file name invisibly.
The template of the task is rendered towards pdf or html in the documentation directory of the specified task. Note that on windows, Gnu zip may be required. The path to the executable must be added to the environment variables.
renderTaskRmd( task, output_format = NULL, debug = FALSE, clean = TRUE, suffix = NA, ... )renderTaskRmd( task, output_format = NULL, debug = FALSE, clean = TRUE, suffix = NA, ... )
task |
Object of class |
output_format |
The R Markdown output format to convert to. The option
|
debug |
if TRUE execute in the global environment. |
clean |
Using |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
... |
Arguments passed on to
|
the file name invisibly.
Get path of report directory.
reportDir(task, subdir = NULL, dirCreate = TRUE)reportDir(task, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
Get path of output file.
reportFn(task, type, ext, subdir = NULL, dirCreate = TRUE)reportFn(task, type, ext, subdir = NULL, dirCreate = TRUE)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
File path.
xlsx output file.Get path of xlsx output file.
reportXlsFn(task, type, ext = "xlsx", subdir = NULL)reportXlsFn(task, type, ext = "xlsx", subdir = NULL)
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
File path.
Restore an archive containing the files of a given task from a file created with archiveTask.
restoreTask(file, overwrite = FALSE, list = FALSE, code = TRUE, ...)restoreTask(file, overwrite = FALSE, list = FALSE, code = TRUE, ...)
file |
full name of the input zip file |
overwrite |
If |
list |
If |
code |
restore code, default TRUE |
... |
Arguments passed on to
|
if list FALSE, the task imported incisibly, otherwise the list of files in the archive.
Get path of R script file name.
rmdFn(task, suffix = NA)rmdFn(task, suffix = NA)
task |
Object of class |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
File path.
Get path of R script file name.
rscriptFn(task, suffix = NA)rscriptFn(task, suffix = NA)
task |
Object of class |
suffix |
Filename suffix, used to develop scripts for sub-analyses for a given task, default NA. |
File path.
Save R object in binary file.
saveBinary( object, task, type, subdir = NULL, dirCreate = TRUE, encrypt = FALSE, ask = FALSE )saveBinary( object, task, type, subdir = NULL, dirCreate = TRUE, encrypt = FALSE, ask = FALSE )
object |
R object to serialize. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
encrypt |
encrypt the output, default: FALSE. If character string, then use the string as password. |
ask |
query encryption key from user, default FALSE. |
the file name invisibly.
Save R object in encrypted binary file.
saveBinaryE(object, task, type, subdir = NULL, dirCreate = TRUE, ask = FALSE)saveBinaryE(object, task, type, subdir = NULL, dirCreate = TRUE, ask = FALSE)
object |
R object to serialize. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
ask |
query encryption key from user, default FALSE. |
the file name invisibly.
Save R object in Apache Arrow feather file.
saveFeather(object, task, type, subdir = NULL, dirCreate = TRUE)saveFeather(object, task, type, subdir = NULL, dirCreate = TRUE)
object |
data.frame to serialize. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
the file name invisibly.
Save R object in Python pickle file.
savePickle(object, task, type, subdir = NULL, dirCreate = TRUE)savePickle(object, task, type, subdir = NULL, dirCreate = TRUE)
object |
data.frame to serialize. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
the file name invisibly.
Output R object in JSON format.
saveReportJSON(x, task, type, ext = "json", subdir = NULL, dirCreate = TRUE)saveReportJSON(x, task, type, ext = "json", subdir = NULL, dirCreate = TRUE)
x |
R object to output. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
the file name invisibly.
write.csv.Output R object using function write.csv.
saveReportTable( x, task, type, ext = "csv", subdir = NULL, dirCreate = TRUE, gzip = FALSE, ... )saveReportTable( x, task, type, ext = "csv", subdir = NULL, dirCreate = TRUE, gzip = FALSE, ... )
x |
R object to output. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
gzip |
unused. |
... |
Arguments passed on to
|
the file name invisibly.
Save R object in binary file.
saveReportXls( x, task, type, ext = "xlsx", subdir = NULL, dirCreate = TRUE, AdjWidth = TRUE, FreezeRow = 1, FreezeCol = 3, metadata = "metadata", metadata.append = NULL, ... )saveReportXls( x, task, type, ext = "xlsx", subdir = NULL, dirCreate = TRUE, AdjWidth = TRUE, FreezeRow = 1, FreezeCol = 3, metadata = "metadata", metadata.append = NULL, ... )
x |
object to save. It can be either a data frame, an object of type |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
AdjWidth |
If |
FreezeRow |
Rows including this row and above this row will be
frozen and not scroll. The default value of |
FreezeCol |
Columns including this column and to the left of this
column will be frozen and not scroll. The default value of
|
metadata |
prefix for names of worksheets holding metadata. |
metadata.append |
array of metadata field names to be appended in header of tables. |
... |
Arguments passed on to
|
the file name invisibly.
Save R data frame to SQLite file. This function saves a data frame to an SQLite database file. It can create indices on specified columns for faster querying. The database file is stored in the task's binary directory.
saveSQLite( object, task, type, subdir = NULL, dirCreate = TRUE, index = NULL, tableName = "data", overwrite = FALSE, append = FALSE, row.names = FALSE )saveSQLite( object, task, type, subdir = NULL, dirCreate = TRUE, index = NULL, tableName = "data", overwrite = FALSE, append = FALSE, row.names = FALSE )
object |
data.frame to serialize. |
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
index |
character vector of column names to create indices on. |
tableName |
name of the table in the SQLite database. |
overwrite |
if |
append |
if |
row.names |
if |
The file name invisibly.
## Not run: task <- loadTask("myproject","mypackage","mytask") # create a sample data frame df <- data.frame(a = 1:5, b = letters[1:5]) # save it to SQLite fn <- saveSQLite(df, task, "testdb",tableName="table1", index = c("a")) # read it back df_loaded <- readSQLite(task,"testdb",tableName="table1") # print the loaded data frame print(df_loaded) # add second data frame df2 <- data.frame(a = 6:10, b = letters[6:10]) saveSQLite(df2, task,"testdb",tableName="table2") # query the data query_result <- querySQLite("SELECT * FROM table2 WHERE a > 8", task,"testdb") print(query_result) #' # append to the first table saveSQLite(df2, task,"testdb",tableName="table1",append=TRUE) # read the updated table df_loaded <- readSQLite(task,"testdb",tableName="table1") # print the updated data frame print(df_loaded) # cleanup unlink(fn) ## End(Not run)## Not run: task <- loadTask("myproject","mypackage","mytask") # create a sample data frame df <- data.frame(a = 1:5, b = letters[1:5]) # save it to SQLite fn <- saveSQLite(df, task, "testdb",tableName="table1", index = c("a")) # read it back df_loaded <- readSQLite(task,"testdb",tableName="table1") # print the loaded data frame print(df_loaded) # add second data frame df2 <- data.frame(a = 6:10, b = letters[6:10]) saveSQLite(df2, task,"testdb",tableName="table2") # query the data query_result <- querySQLite("SELECT * FROM table2 WHERE a > 8", task,"testdb") print(query_result) #' # append to the first table saveSQLite(df2, task,"testdb",tableName="table1",append=TRUE) # read the updated table df_loaded <- readSQLite(task,"testdb",tableName="table1") # print the updated data frame print(df_loaded) # cleanup unlink(fn) ## End(Not run)
scan.Read data into vector or list using function scan.
scanReport( task, type, ext = "txt", subdir = NULL, dirCreate = TRUE, what = "", ... )scanReport( task, type, ext = "txt", subdir = NULL, dirCreate = TRUE, what = "", ... )
task |
Object of class |
type |
Filename type. If the type is an array, the cocatenation of the elements is used with separator"-". Filenames have the form [task name]_[type].[ext] |
ext |
Filename extension. |
subdir |
(optional) Subdirectory. |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
what |
the type of |
... |
Arguments passed on to
|
the data read, or NULL if the file does not exist.
Set the name of the tasks author.
setTaskAuthor(author)setTaskAuthor(author)
author |
Author name, system username by default. |
The current name of the tasks author.
setTaskAuthor("Doe Johns")setTaskAuthor("Doe Johns")
Set the encryption key for binary data files.
setTaskEnckey(key)setTaskEnckey(key)
key |
encryption key, if NULL then query key from user. |
NULL invisibly.
Set the path to the Quarto task template.
setTaskQmdTemplate(file, encoding = "unknown")setTaskQmdTemplate(file, encoding = "unknown")
file |
path to the Quarto task template. |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
The path to the Quato task template invisibly.
Set the path to the Rmd task template.
setTaskRmdTemplate(file, encoding = "unknown")setTaskRmdTemplate(file, encoding = "unknown")
file |
path to the Rmd task template. |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
The path to the Rmd task template invisibly.
Set the root of the task repository.
setTaskRoot(rootpath, dirCreate = FALSE)setTaskRoot(rootpath, dirCreate = FALSE)
rootpath |
Path of the task repository, default set by |
dirCreate |
Logical, if TRUE (by default) the directory is created. |
Path to the current task root.
Set the path to the R script task template.
setTaskRscriptTemplate(file)setTaskRscriptTemplate(file)
file |
path to the Rmd task template. |
The path to the Rmd task template invisibly.
Set the name of the tasks sponsor.
setTaskSponsor(sponsor)setTaskSponsor(sponsor)
sponsor |
Sponsor name, default set by |
The current name of the tasks sponsor.
setTaskSponsor("SQU4RE")setTaskSponsor("SQU4RE")
Set task repository directory structure.
setTaskStructure(pathgen)setTaskStructure(pathgen)
pathgen |
optional function returning a list of paths, currently |
The task directory structure function invisibly.
fun <- function(project,package,taskname,sponsor) { basePath <- file.path("%ROOT%",sponsor,project,package) list( root = "%ROOT%", datasrc = file.path(basePath, "raw", "data_source"), data = file.path(basePath, "output","adhoc",taskname), bin = file.path(basePath, "output","adhoc",taskname,"bin"), code = file.path(basePath, "progs"), doc = file.path(basePath, "docs"), log = file.path(basePath, "output","log") ) } setTaskStructure(fun)fun <- function(project,package,taskname,sponsor) { basePath <- file.path("%ROOT%",sponsor,project,package) list( root = "%ROOT%", datasrc = file.path(basePath, "raw", "data_source"), data = file.path(basePath, "output","adhoc",taskname), bin = file.path(basePath, "output","adhoc",taskname,"bin"), code = file.path(basePath, "progs"), doc = file.path(basePath, "docs"), log = file.path(basePath, "output","log") ) } setTaskStructure(fun)
Get task identifier string.
taskID(task, sep = "/")taskID(task, sep = "/")
task |
Object of class |
sep |
the field separator character, default: "/". |
String with task ID as:[sponsor][sep][project][sep][package][sep][task]