diff --git a/NAMESPACE b/NAMESPACE index 2506bf1..bed4902 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -50,6 +50,7 @@ export(lastnews_table) export(load_as_list) export(load_list) export(manual_correction) +export(read_all_xpt) export(read_tm_all_xpt) export(read_trialmaster) export(reset_manual_correction) diff --git a/R/trialmaster.R b/R/trialmaster.R index 017e3af..b358c4c 100644 --- a/R/trialmaster.R +++ b/R/trialmaster.R @@ -78,13 +78,13 @@ read_trialmaster = function(archive, ..., use_cache="write", class="edc_tm_no_procformat_warning") format_file = NULL } - rtn = read_tm_all_xpt(temp_folder, format_file=format_file, - clean_names_fun=clean_names_fun, - split_mixed=split_mixed, - extend_lookup=extend_lookup, - key_columns=key_columns, - datetime_extraction=extract_datetime, - verbose=verbose) + rtn = read_all_xpt(temp_folder, format_file=format_file, + clean_names_fun=clean_names_fun, + split_mixed=split_mixed, + extend_lookup=extend_lookup, + key_columns=key_columns, + datetime_extraction=extract_datetime, + verbose=verbose) if(isTRUE(use_cache) || use_cache=="write"){ if(verbose>0) cli_inform("Writing cache file {.file {cache_file}}", class="read_tm_zip") @@ -134,13 +134,13 @@ read_trialmaster = function(archive, ..., use_cache="write", #' @importFrom tibble as_tibble tibble #' @importFrom tidyselect where #' @importFrom utils packageVersion -read_tm_all_xpt = function(directory, ..., format_file="procformat.sas", - clean_names_fun=NULL, - split_mixed=FALSE, - extend_lookup=TRUE, - datetime_extraction=NULL, - verbose=getOption("edc_read_verbose", 1), - key_columns="deprecated"){ +read_all_xpt = function(directory, ..., format_file="procformat.sas", + clean_names_fun=NULL, + split_mixed=FALSE, + extend_lookup=TRUE, + datetime_extraction=NULL, + verbose=getOption("edc_read_verbose", 1), + key_columns="deprecated"){ check_dots_empty() reset_manual_correction() clean_names_fun = get_clean_names_fun(clean_names_fun) @@ -263,6 +263,12 @@ read_tm_all_xpt = function(directory, ..., format_file="procformat.sas", } +#' @rdname read_all_xpt +#' @export +#' @usage NULL +read_tm_all_xpt = read_all_xpt + + # Utils --------------------------------------------------------------------------------------- #' @noRd diff --git a/man/read_tm_all_xpt.Rd b/man/read_all_xpt.Rd similarity index 96% rename from man/read_tm_all_xpt.Rd rename to man/read_all_xpt.Rd index c529ae6..3a4f8fb 100644 --- a/man/read_tm_all_xpt.Rd +++ b/man/read_all_xpt.Rd @@ -1,45 +1,46 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/trialmaster.R -\name{read_tm_all_xpt} -\alias{read_tm_all_xpt} -\title{Read all \code{.xpt} files in a directory} -\usage{ -read_tm_all_xpt( - directory, - ..., - format_file = "procformat.sas", - clean_names_fun = NULL, - split_mixed = FALSE, - extend_lookup = TRUE, - datetime_extraction = NULL, - verbose = getOption("edc_read_verbose", 1), - key_columns = "deprecated" -) -} -\arguments{ -\item{directory}{[\code{character(1)}]\cr the path to the unzipped archive using SAS_XPORT format. Will read the extraction date from the directory name.} - -\item{...}{unused} - -\item{format_file}{[\code{character(1)}]\cr the path to the \code{procformat.sas} file that should be used to apply formats. Use \code{NULL} to not apply formats.} - -\item{clean_names_fun}{[\code{function}]\cr a function to clean column names, e.g. \link{tolower}, \code{\link[janitor:clean_names]{janitor::clean_names()}},...} - -\item{split_mixed}{[\code{logical(1): FALSE}]\cr whether to split mixed datasets. See \link{split_mixed_datasets}.} - -\item{extend_lookup}{[\code{character(1): FALSE}]\cr whether to enrich the lookup table. See \link{extend_lookup}.} - -\item{datetime_extraction}{[\code{POSIXt(1)}]\cr the datetime of the data extraction. Default to the most common date of last modification in \code{directory}.} - -\item{verbose}{[\code{logical(1)}]\cr one of \code{c(0, 1, 2)}. The higher, the more information will be printed.} - -\item{key_columns}{deprecated} -} -\value{ -a list containing one dataframe for each \code{.xpt} file in the folder, the extraction date (\code{datetime_extraction}), and a summary of all imported tables (\code{.lookup}). If not set yet, option \code{edc_lookup} is automatically set to \code{.lookup}. -} -\description{ -Read all \code{.xpt} files in a directory (unzipped TrialMaster archive). \cr -If \verb{7zip} is installed, you should probably rather use \code{\link[=read_trialmaster]{read_trialmaster()}} instead. \cr -If a \code{procformat.sas} file exists in the directory, formats will be applied. -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/trialmaster.R +\name{read_all_xpt} +\alias{read_all_xpt} +\alias{read_tm_all_xpt} +\title{Read all \code{.xpt} files in a directory} +\usage{ +read_all_xpt( + directory, + ..., + format_file = "procformat.sas", + clean_names_fun = NULL, + split_mixed = FALSE, + extend_lookup = TRUE, + datetime_extraction = NULL, + verbose = getOption("edc_read_verbose", 1), + key_columns = "deprecated" +) +} +\arguments{ +\item{directory}{[\code{character(1)}]\cr the path to the unzipped archive using SAS_XPORT format. Will read the extraction date from the directory name.} + +\item{...}{unused} + +\item{format_file}{[\code{character(1)}]\cr the path to the \code{procformat.sas} file that should be used to apply formats. Use \code{NULL} to not apply formats.} + +\item{clean_names_fun}{[\code{function}]\cr a function to clean column names, e.g. \link{tolower}, \code{\link[janitor:clean_names]{janitor::clean_names()}},...} + +\item{split_mixed}{[\code{logical(1): FALSE}]\cr whether to split mixed datasets. See \link{split_mixed_datasets}.} + +\item{extend_lookup}{[\code{character(1): FALSE}]\cr whether to enrich the lookup table. See \link{extend_lookup}.} + +\item{datetime_extraction}{[\code{POSIXt(1)}]\cr the datetime of the data extraction. Default to the most common date of last modification in \code{directory}.} + +\item{verbose}{[\code{logical(1)}]\cr one of \code{c(0, 1, 2)}. The higher, the more information will be printed.} + +\item{key_columns}{deprecated} +} +\value{ +a list containing one dataframe for each \code{.xpt} file in the folder, the extraction date (\code{datetime_extraction}), and a summary of all imported tables (\code{.lookup}). If not set yet, option \code{edc_lookup} is automatically set to \code{.lookup}. +} +\description{ +Read all \code{.xpt} files in a directory (unzipped TrialMaster archive). \cr +If \verb{7zip} is installed, you should probably rather use \code{\link[=read_trialmaster]{read_trialmaster()}} instead. \cr +If a \code{procformat.sas} file exists in the directory, formats will be applied. +} diff --git a/man/search_for_newer_data.Rd b/man/search_for_newer_data.Rd index 26275c8..b13ca8f 100644 --- a/man/search_for_newer_data.Rd +++ b/man/search_for_newer_data.Rd @@ -7,7 +7,7 @@ search_for_newer_data( archive, ..., - source = c("data", path_home("Downloads")), + source = path_home("Downloads"), target = "data", ask = TRUE, advice = TRUE