diff --git a/DESCRIPTION b/DESCRIPTION index ab96677..27cd967 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,7 +34,8 @@ Suggests: roxygen2, spelling, rhub, - rsconnect + rsconnect, + pkgconfig License: GPL (>= 3) Encoding: UTF-8 LazyData: true @@ -50,24 +51,26 @@ Imports: purrr, readr, stats, - shiny, - haven, zip, assertthat, - openxlsx2, - readODS, forcats, vctrs, gt, bslib, here, glue, - gtsummary + gtsummary, + shiny, + haven, + openxlsx2, + readODS +Language: en-US +VignetteBuilder: knitr Collate: 'REDCapCAST-package.R' - 'utils.R' - 'process_user_input.R' - 'REDCap_split.R' + 'utils.r' + 'process_user_input.r' + 'REDCap_split.r' 'as_factor.R' 'doc2dd.R' 'ds2dd_detailed.R' @@ -82,5 +85,3 @@ Collate: 'redcapcast_data.R' 'redcapcast_meta.R' 'shiny_cast.R' -Language: en-US -VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 078a7c7..7271809 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -74,11 +74,15 @@ importFrom(REDCapR,redcap_metadata_read) importFrom(REDCapR,redcap_read) importFrom(forcats,as_factor) importFrom(forcats,fct_drop) +importFrom(haven,read_dta) importFrom(keyring,key_get) importFrom(keyring,key_list) importFrom(keyring,key_set) importFrom(openxlsx2,read_xlsx) importFrom(purrr,reduce) +importFrom(readODS,read_ods) importFrom(readr,parse_time) +importFrom(readr,read_csv) +importFrom(readr,read_rds) importFrom(tidyr,pivot_wider) importFrom(tidyselect,all_of) diff --git a/R/REDCap_split.r b/R/REDCap_split.r index d89aaf8..a9e617a 100644 --- a/R/REDCap_split.r +++ b/R/REDCap_split.r @@ -80,7 +80,7 @@ #' \item \code{'all'}: a data.frame for each instrument, regardless of #' whether it is a repeating instrument or not. #' } -#' @include process_user_input.R utils.R +#' @include process_user_input.r utils.r #' @export REDCap_split <- function(records, metadata, diff --git a/R/read_redcap_tables.R b/R/read_redcap_tables.R index 26ec207..b530333 100644 --- a/R/read_redcap_tables.R +++ b/R/read_redcap_tables.R @@ -31,7 +31,7 @@ #' #' @return list of instruments #' @importFrom REDCapR redcap_metadata_read redcap_read redcap_event_instruments -#' @include utils.R +#' @include utils.r #' @export #' #' @examples diff --git a/R/shiny_cast.R b/R/shiny_cast.R index 08d7d6e..6a462bd 100644 --- a/R/shiny_cast.R +++ b/R/shiny_cast.R @@ -47,6 +47,12 @@ file_extension <- function(filenames) { #' @return tibble #' @export #' +#' @importFrom openxlsx2 read_xlsx +#' @importFrom haven read_dta +#' @importFrom readODS read_ods +#' @importFrom readr read_csv read_rds +#' +#' #' @examples #' read_input("https://raw.githubusercontent.com/agdamsbo/cognitive.index.lookup/main/data/sample.csv") read_input <- function(file, consider.na = c("NA", '""', "")) { @@ -55,15 +61,15 @@ read_input <- function(file, consider.na = c("NA", '""', "")) { tryCatch( { if (ext == "csv") { - df <- readr::read_csv(file = file, na = consider.na) + df <- read_csv(file = file, na = consider.na) } else if (ext %in% c("xls", "xlsx")) { - df <- openxlsx2::read_xlsx(file = file, na.strings = consider.na) + df <- read_xlsx(file = file, na.strings = consider.na) } else if (ext == "dta") { - df <- haven::read_dta(file = file) + df <- read_dta(file = file) } else if (ext == "ods") { - df <- readODS::read_ods(path = file) + df <- read_ods(path = file) } else if (ext == "rds") { - df <- readr::read_rds(file = file) + df <- read_rds(file = file) }else { stop("Input file format has to be on of: '.csv', '.xls', '.xlsx', '.dta', '.ods' or '.rds'") diff --git a/REDCapCAST.Rproj b/REDCapCAST.Rproj index cfc222c..012f82a 100644 --- a/REDCapCAST.Rproj +++ b/REDCapCAST.Rproj @@ -19,4 +19,5 @@ StripTrailingWhitespace: Yes BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source +PackageCheckArgs: --as-cran PackageRoxygenize: rd,collate,namespace,vignette diff --git a/man/REDCapCAST-package.Rd b/man/REDCapCAST-package.Rd index 32f0b06..c7b06c2 100644 --- a/man/REDCapCAST-package.Rd +++ b/man/REDCapCAST-package.Rd @@ -6,8 +6,6 @@ \alias{REDCapCAST-package} \title{REDCapCAST: REDCap Metadata Casting and Castellated Data Handling} \description{ -\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} - Casting metadata for REDCap database creation and handling of castellated data using repeated instruments and longitudinal projects in 'REDCap'. Keeps a focused data export approach, by allowing to only export required data from the database. Also for casting new REDCap databases based on datasets from other sources. Originally forked from the R part of 'REDCapRITS' by Paul Egeler. See \url{https://github.com/pegeler/REDCapRITS}. 'REDCap' (Research Electronic Data Capture) is a secure, web-based software platform designed to support data capture for research studies, providing 1) an intuitive interface for validated data capture; 2) audit trails for tracking data manipulation and export procedures; 3) automated export procedures for seamless data downloads to common statistical packages; and 4) procedures for data integration and interoperability with external sources (Harris et al (2009) \doi{10.1016/j.jbi.2008.08.010}; Harris et al (2019) \doi{10.1016/j.jbi.2019.103208}). } \seealso{ diff --git a/man/REDCap_split.Rd b/man/REDCap_split.Rd index 86df0ad..1389ac8 100644 --- a/man/REDCap_split.Rd +++ b/man/REDCap_split.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/REDCap_split.R +% Please edit documentation in R/REDCap_split.r \name{REDCap_split} \alias{REDCap_split} \title{Split REDCap repeating instruments table into multiple tables} diff --git a/man/clean_redcap_name.Rd b/man/clean_redcap_name.Rd index 6559e56..8040bf7 100644 --- a/man/clean_redcap_name.Rd +++ b/man/clean_redcap_name.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{clean_redcap_name} \alias{clean_redcap_name} \title{clean_redcap_name} diff --git a/man/cut_string_length.Rd b/man/cut_string_length.Rd index 2c143de..0264e20 100644 --- a/man/cut_string_length.Rd +++ b/man/cut_string_length.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{cut_string_length} \alias{cut_string_length} \title{Cut string to desired length} diff --git a/man/d2w.Rd b/man/d2w.Rd index ba6b585..ef41520 100644 --- a/man/d2w.Rd +++ b/man/d2w.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{d2w} \alias{d2w} \title{Convert single digits to words} diff --git a/man/figures/logo.png b/man/figures/logo.png deleted file mode 100644 index 714ef58..0000000 Binary files a/man/figures/logo.png and /dev/null differ diff --git a/man/figures/rook-cap.png b/man/figures/rook-cap.png deleted file mode 100644 index 97fbf0f..0000000 Binary files a/man/figures/rook-cap.png and /dev/null differ diff --git a/man/focused_metadata.Rd b/man/focused_metadata.Rd index f9a0380..5eea785 100644 --- a/man/focused_metadata.Rd +++ b/man/focused_metadata.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{focused_metadata} \alias{focused_metadata} \title{focused_metadata} diff --git a/man/get_id_name.Rd b/man/get_id_name.Rd index 7e85f74..ba12779 100644 --- a/man/get_id_name.Rd +++ b/man/get_id_name.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{get_id_name} \alias{get_id_name} \title{Get the id name} diff --git a/man/is_repeated_longitudinal.Rd b/man/is_repeated_longitudinal.Rd index 838726c..c12bfd2 100644 --- a/man/is_repeated_longitudinal.Rd +++ b/man/is_repeated_longitudinal.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{is_repeated_longitudinal} \alias{is_repeated_longitudinal} \title{Test if repeatable or longitudinal} diff --git a/man/match_fields_to_form.Rd b/man/match_fields_to_form.Rd index cd89985..6dae0c6 100644 --- a/man/match_fields_to_form.Rd +++ b/man/match_fields_to_form.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{match_fields_to_form} \alias{match_fields_to_form} \title{Match fields to forms} diff --git a/man/process_user_input.Rd b/man/process_user_input.Rd index 3defafa..684e7c0 100644 --- a/man/process_user_input.Rd +++ b/man/process_user_input.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/process_user_input.R +% Please edit documentation in R/process_user_input.r \name{process_user_input} \alias{process_user_input} \title{User input processing} diff --git a/man/process_user_input.character.Rd b/man/process_user_input.character.Rd index 112f835..4146734 100644 --- a/man/process_user_input.character.Rd +++ b/man/process_user_input.character.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/process_user_input.R +% Please edit documentation in R/process_user_input.r \name{process_user_input.character} \alias{process_user_input.character} \title{User input processing character} diff --git a/man/process_user_input.data.frame.Rd b/man/process_user_input.data.frame.Rd index 3c08937..2ad15c1 100644 --- a/man/process_user_input.data.frame.Rd +++ b/man/process_user_input.data.frame.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/process_user_input.R +% Please edit documentation in R/process_user_input.r \name{process_user_input.data.frame} \alias{process_user_input.data.frame} \title{User input processing data.frame} diff --git a/man/process_user_input.default.Rd b/man/process_user_input.default.Rd index 0f3dbe8..ad9c83b 100644 --- a/man/process_user_input.default.Rd +++ b/man/process_user_input.default.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/process_user_input.R +% Please edit documentation in R/process_user_input.r \name{process_user_input.default} \alias{process_user_input.default} \title{User input processing default} diff --git a/man/process_user_input.response.Rd b/man/process_user_input.response.Rd index 34f5132..b69b5f3 100644 --- a/man/process_user_input.response.Rd +++ b/man/process_user_input.response.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/process_user_input.R +% Please edit documentation in R/process_user_input.r \name{process_user_input.response} \alias{process_user_input.response} \title{User input processing response} diff --git a/man/sanitize_split.Rd b/man/sanitize_split.Rd index c11e60d..a150792 100644 --- a/man/sanitize_split.Rd +++ b/man/sanitize_split.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{sanitize_split} \alias{sanitize_split} \title{Sanitize list of data frames} diff --git a/man/split_non_repeating_forms.Rd b/man/split_non_repeating_forms.Rd index a769903..b29fd71 100644 --- a/man/split_non_repeating_forms.Rd +++ b/man/split_non_repeating_forms.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{split_non_repeating_forms} \alias{split_non_repeating_forms} \title{Split a data frame into separate tables for each form} diff --git a/man/strsplitx.Rd b/man/strsplitx.Rd index c609b22..464c6a3 100644 --- a/man/strsplitx.Rd +++ b/man/strsplitx.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R +% Please edit documentation in R/utils.r \name{strsplitx} \alias{strsplitx} \title{Extended string splitting}