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,
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

View File

@ -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)

View File

@ -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,

View File

@ -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

View File

@ -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'")

View File

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

View File

@ -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{

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

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
% Please edit documentation in R/utils.R
% Please edit documentation in R/utils.r
\name{focused_metadata}
\alias{focused_metadata}
\title{focused_metadata}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}