mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 05:07:30 +02:00
new version
This commit is contained in:
parent
1bdbb0df94
commit
4cd484bd6b
5 changed files with 61 additions and 30 deletions
|
|
@ -506,6 +506,7 @@ is_repeated_longitudinal <- function(data, generics = c(
|
|||
#'
|
||||
#' @examples
|
||||
#' file_extension(list.files(here::here(""))[[2]])[[1]]
|
||||
#' file_extension(c("file.cd..ks","file"))
|
||||
file_extension <- function(filenames) {
|
||||
sub(pattern = "^(.*\\.|[^.]+)(?=[^.]*)", replacement = "",
|
||||
filenames,
|
||||
|
|
@ -533,8 +534,11 @@ read_input <- function(file, consider.na = c("NA", '""', "")) {
|
|||
df <- openxlsx2::read_xlsx(file = file, na.strings = consider.na)
|
||||
} else if (ext == "dta") {
|
||||
df <- haven::read_dta(file = file)
|
||||
} else if (ext == "ods") {
|
||||
df <- readODS::read_ods(file = file)
|
||||
} else {
|
||||
stop("Input file format has to be either '.csv', '.xls' or '.xlsx'")
|
||||
stop("Input file format has to be on of:
|
||||
'.csv', '.xls', '.xlsx', '.dta' or '.ods'")
|
||||
}
|
||||
},
|
||||
error = function(e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue