This commit is contained in:
Andreas Gammelgaard Damsbo 2025-01-29 11:17:49 +01:00
parent 8d20901636
commit 7bbc147304
No known key found for this signature in database
25 changed files with 46 additions and 36 deletions

View File

@ -34,7 +34,8 @@ Suggests:
roxygen2, roxygen2,
spelling, spelling,
rhub, rhub,
rsconnect rsconnect,
pkgconfig
License: GPL (>= 3) License: GPL (>= 3)
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
@ -50,24 +51,26 @@ Imports:
purrr, purrr,
readr, readr,
stats, stats,
shiny,
haven,
zip, zip,
assertthat, assertthat,
openxlsx2,
readODS,
forcats, forcats,
vctrs, vctrs,
gt, gt,
bslib, bslib,
here, here,
glue, glue,
gtsummary gtsummary,
shiny,
haven,
openxlsx2,
readODS
Language: en-US
VignetteBuilder: knitr
Collate: Collate:
'REDCapCAST-package.R' 'REDCapCAST-package.R'
'utils.R' 'utils.r'
'process_user_input.R' 'process_user_input.r'
'REDCap_split.R' 'REDCap_split.r'
'as_factor.R' 'as_factor.R'
'doc2dd.R' 'doc2dd.R'
'ds2dd_detailed.R' 'ds2dd_detailed.R'
@ -82,5 +85,3 @@ Collate:
'redcapcast_data.R' 'redcapcast_data.R'
'redcapcast_meta.R' 'redcapcast_meta.R'
'shiny_cast.R' 'shiny_cast.R'
Language: en-US
VignetteBuilder: knitr

View File

@ -74,11 +74,15 @@ importFrom(REDCapR,redcap_metadata_read)
importFrom(REDCapR,redcap_read) importFrom(REDCapR,redcap_read)
importFrom(forcats,as_factor) importFrom(forcats,as_factor)
importFrom(forcats,fct_drop) importFrom(forcats,fct_drop)
importFrom(haven,read_dta)
importFrom(keyring,key_get) importFrom(keyring,key_get)
importFrom(keyring,key_list) importFrom(keyring,key_list)
importFrom(keyring,key_set) importFrom(keyring,key_set)
importFrom(openxlsx2,read_xlsx) importFrom(openxlsx2,read_xlsx)
importFrom(purrr,reduce) importFrom(purrr,reduce)
importFrom(readODS,read_ods)
importFrom(readr,parse_time) importFrom(readr,parse_time)
importFrom(readr,read_csv)
importFrom(readr,read_rds)
importFrom(tidyr,pivot_wider) importFrom(tidyr,pivot_wider)
importFrom(tidyselect,all_of) importFrom(tidyselect,all_of)

View File

@ -80,7 +80,7 @@
#' \item \code{'all'}: a data.frame for each instrument, regardless of #' \item \code{'all'}: a data.frame for each instrument, regardless of
#' whether it is a repeating instrument or not. #' whether it is a repeating instrument or not.
#' } #' }
#' @include process_user_input.R utils.R #' @include process_user_input.r utils.r
#' @export #' @export
REDCap_split <- function(records, REDCap_split <- function(records,
metadata, metadata,

View File

@ -31,7 +31,7 @@
#' #'
#' @return list of instruments #' @return list of instruments
#' @importFrom REDCapR redcap_metadata_read redcap_read redcap_event_instruments #' @importFrom REDCapR redcap_metadata_read redcap_read redcap_event_instruments
#' @include utils.R #' @include utils.r
#' @export #' @export
#' #'
#' @examples #' @examples

View File

@ -47,6 +47,12 @@ file_extension <- function(filenames) {
#' @return tibble #' @return tibble
#' @export #' @export
#' #'
#' @importFrom openxlsx2 read_xlsx
#' @importFrom haven read_dta
#' @importFrom readODS read_ods
#' @importFrom readr read_csv read_rds
#'
#'
#' @examples #' @examples
#' read_input("https://raw.githubusercontent.com/agdamsbo/cognitive.index.lookup/main/data/sample.csv") #' read_input("https://raw.githubusercontent.com/agdamsbo/cognitive.index.lookup/main/data/sample.csv")
read_input <- function(file, consider.na = c("NA", '""', "")) { read_input <- function(file, consider.na = c("NA", '""', "")) {
@ -55,15 +61,15 @@ read_input <- function(file, consider.na = c("NA", '""', "")) {
tryCatch( tryCatch(
{ {
if (ext == "csv") { 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")) { } 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") { } else if (ext == "dta") {
df <- haven::read_dta(file = file) df <- read_dta(file = file)
} else if (ext == "ods") { } else if (ext == "ods") {
df <- readODS::read_ods(path = file) df <- read_ods(path = file)
} else if (ext == "rds") { } else if (ext == "rds") {
df <- readr::read_rds(file = file) df <- read_rds(file = file)
}else { }else {
stop("Input file format has to be on of: stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx', '.dta', '.ods' or '.rds'") '.csv', '.xls', '.xlsx', '.dta', '.ods' or '.rds'")

View File

@ -19,4 +19,5 @@ StripTrailingWhitespace: Yes
BuildType: Package BuildType: Package
PackageUseDevtools: Yes PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace,vignette PackageRoxygenize: rd,collate,namespace,vignette

View File

@ -6,8 +6,6 @@
\alias{REDCapCAST-package} \alias{REDCapCAST-package}
\title{REDCapCAST: REDCap Metadata Casting and Castellated Data Handling} \title{REDCapCAST: REDCap Metadata Casting and Castellated Data Handling}
\description{ \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}). 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{ \seealso{

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{REDCap_split}
\alias{REDCap_split} \alias{REDCap_split}
\title{Split REDCap repeating instruments table into multiple tables} \title{Split REDCap repeating instruments table into multiple tables}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{clean_redcap_name}
\alias{clean_redcap_name} \alias{clean_redcap_name}
\title{clean_redcap_name} \title{clean_redcap_name}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{cut_string_length}
\alias{cut_string_length} \alias{cut_string_length}
\title{Cut string to desired length} \title{Cut string to desired length}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R % Please edit documentation in R/utils.r
\name{d2w} \name{d2w}
\alias{d2w} \alias{d2w}
\title{Convert single digits to words} \title{Convert single digits to words}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{focused_metadata}
\alias{focused_metadata} \alias{focused_metadata}
\title{focused_metadata} \title{focused_metadata}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{get_id_name}
\alias{get_id_name} \alias{get_id_name}
\title{Get the id name} \title{Get the id name}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{is_repeated_longitudinal}
\alias{is_repeated_longitudinal} \alias{is_repeated_longitudinal}
\title{Test if repeatable or longitudinal} \title{Test if repeatable or longitudinal}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{match_fields_to_form}
\alias{match_fields_to_form} \alias{match_fields_to_form}
\title{Match fields to forms} \title{Match fields to forms}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{process_user_input}
\alias{process_user_input} \alias{process_user_input}
\title{User input processing} \title{User input processing}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{process_user_input.character}
\alias{process_user_input.character} \alias{process_user_input.character}
\title{User input processing character} \title{User input processing character}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{process_user_input.data.frame}
\alias{process_user_input.data.frame} \alias{process_user_input.data.frame}
\title{User input processing data.frame} \title{User input processing data.frame}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{process_user_input.default}
\alias{process_user_input.default} \alias{process_user_input.default}
\title{User input processing default} \title{User input processing default}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{process_user_input.response}
\alias{process_user_input.response} \alias{process_user_input.response}
\title{User input processing response} \title{User input processing response}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{sanitize_split}
\alias{sanitize_split} \alias{sanitize_split}
\title{Sanitize list of data frames} \title{Sanitize list of data frames}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % 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} \name{split_non_repeating_forms}
\alias{split_non_repeating_forms} \alias{split_non_repeating_forms}
\title{Split a data frame into separate tables for each form} \title{Split a data frame into separate tables for each form}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R % Please edit documentation in R/utils.r
\name{strsplitx} \name{strsplitx}
\alias{strsplitx} \alias{strsplitx}
\title{Extended string splitting} \title{Extended string splitting}