mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 05:07:30 +02:00
new docs
This commit is contained in:
parent
8d20901636
commit
7bbc147304
25 changed files with 46 additions and 36 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue