From 6ddf5b6e7554e530e9629b1fe23ddb5e489e9acd Mon Sep 17 00:00:00 2001 From: AQLT Date: Sun, 1 Oct 2023 21:48:54 +0200 Subject: [PATCH] doc --- R/Cruncher.R | 23 ++++++++++++++----- R/download_cruncher.R | 4 ++-- R/param_file.R | 42 ++++++++++++++++++++++++++++++----- man/configure_jwsacruncher.Rd | 2 +- man/create_param_file.Rd | 14 +++++++++++- man/cruncher.Rd | 16 ++++++++++++- man/cruncher_and_param.Rd | 4 ++-- man/default_param_file.Rd | 3 +++ man/download_cruncher.Rd | 2 +- man/list2param_file.Rd | 17 +++++++++++++- man/multiprocessing_names.Rd | 2 +- man/read_param_file.Rd | 14 ++++++++++-- man/update_workspace.Rd | 2 +- 13 files changed, 122 insertions(+), 23 deletions(-) diff --git a/R/Cruncher.R b/R/Cruncher.R index 6998d15..8e60a84 100644 --- a/R/Cruncher.R +++ b/R/Cruncher.R @@ -9,7 +9,20 @@ #' @param log_file Name of the log file of 'JWSACruncher'. By default the log isn't exported. #' @encoding UTF-8 #' @return The path to the workspace. -#' @seealso \code{\link{cruncher_and_param}}, \code{\link{update_workspace}}. +#' @seealso Around the 'JWSACruncher': [cruncher_and_param()], [update_workspace()]. +#' To create the parameter file: [create_param_file()] and [list2param_file()]. +#' @examples +#' \dontrun{ +#' dir = tempdir() +#' # First create a parameter file +#' # here a file parameters.param is created in the directory dir +#' # with default parameters of 'JWSACruncher' v2 +#' list2param_file(dir, default_param_file(v3 = FALSE)) +#' # If the option "cruncher_bin_directory" is correctly defined: +#' cruncher("workspace.xml", +#' param_file_path = file.path(dir, "parameters.param")) +#' } +#' #' @export cruncher <- function(workspace, cruncher_bin_directory = getOption("cruncher_bin_directory"), @@ -100,8 +113,8 @@ cruncher <- function(workspace, #' By default \code{rename_multi_documents = FALSE}: the names of the XML files of the multi-documents are used. #' @param delete_existing_file Only used if \code{rename_multi_documents = TRUE}. Boolean indicating whether to #' delete existing folders when renaming them. By default (\code{delete_existing_file = FALSE}) they are not deleted. -#' @param ... Other parameters of \link{create_param_file}. -#' @seealso \code{\link{cruncher}}, \code{\link{update_workspace}}, \code{\link{create_param_file}}, \code{\link{multiprocessing_names}}. +#' @param ... Other parameters of [create_param_file()]. +#' @seealso [cruncher()], [update_workspace()], [create_param_file()], [multiprocessing_names()]. #' @encoding UTF-8 #' @return Path to the workspace. #' @export @@ -156,7 +169,7 @@ cruncher_and_param <- function(workspace = NULL, #' @encoding UTF-8 #' @return A \code{data.frame} containing the name of the multiprocessings that appears on 'JDemetra+' (column \code{name}) and #' the name of the associated XML files (column \code{file}). -#' @seealso \code{\link{cruncher_and_param}}. +#' @seealso [cruncher_and_param()]. #' @export multiprocessing_names <- function(workspace){ if (missing(workspace) || is.null(workspace)) { @@ -196,7 +209,7 @@ multiprocessing_names <- function(workspace){ #' @inheritParams create_param_file #' @encoding UTF-8 #' @return Path to the workspace. -#' @seealso \code{\link{cruncher}}, \code{\link{cruncher_and_param}}. +#' @seealso [cruncher()], [cruncher_and_param()]. #' @export update_workspace <- function(workspace = NULL, policy = "parameters", diff --git a/R/download_cruncher.R b/R/download_cruncher.R index ea4ed84..1837143 100644 --- a/R/download_cruncher.R +++ b/R/download_cruncher.R @@ -22,7 +22,7 @@ #' # To download the release of the version 2.2.2: #' download_cruncher(dir, "2.2.2") #' } -#' @seealso \code{\link{configure_jwsacruncher}}. +#' @seealso [configure_jwsacruncher()]. #' @export download_cruncher <- function(directory, cruncher_version, v3 = getOption("is_cruncher_v3")){ if (missing(directory)) { @@ -109,7 +109,7 @@ download_cruncher <- function(directory, cruncher_version, v3 = getOption("is_cr #' } #' The function \code{configure_jwsacruncher()} does the steps 2 and 3. #' -#' @seealso \code{\link{download_cruncher}}. +#' @seealso [download_cruncher()]. #' @encoding UTF-8 #' @export configure_jwsacruncher <- function(jwsacruncher_path, java_path){ diff --git a/R/param_file.R b/R/param_file.R index da921f9..66a8a5c 100644 --- a/R/param_file.R +++ b/R/param_file.R @@ -30,8 +30,19 @@ #' } #' #' @return Path to the parameter file. -#' @seealso \code{\link{cruncher_and_param}}. +#' @seealso [read_param_file()], [list2param_file()], [default_param_file] [cruncher_and_param()]. #' @encoding UTF-8 +#' @examples +#' \dontrun{ +#' dir = tempdir() +#' # Here a file parameters.param is created in the directory dir +#' # with default parameters of the different options +#' create_param_file(dir) +#' # to only export the raw and the seasonally adjusted series +#' create_param_file(dir, +#' tsmatrix_series = c("y", "sa")) +#' } +#' #' @export create_param_file <- function( dir_file_param, bundle = 10000, csv_layout = "list", csv_separator = ";", @@ -92,9 +103,17 @@ create_param_file <- function( return(invisible(paste0(dir_file_param,"/parameters.param"))) } -#' Create parameter file for the 'JWSACruncher' +#' Read parameter file of the 'JWSACruncher' #' #' @param file Path to the parameter file. +#' +#' @seealso [create_param_file()], [list2param_file()], [default_param_file()] [cruncher_and_param()]. +#' @examples +#' dir = tempdir() +#' list_param <- default_param_file(v3 = FALSE) +#' list2param_file(dir, list_param) +#' list_param_2 <- read_param_file(file.path(dir, "parameters.param")) +#' all.equal(list_param, list_param_2) #' @export read_param_file <- function(file){ f <- readLines(file) @@ -127,7 +146,7 @@ read_param_file <- function(file){ refreshall <- grep("refreshall", f, value = TRUE) if (length(refreshall) > 0) { refreshall <- gsub("(.*)|(