new version

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-04-09 10:54:52 +02:00
commit 4cd484bd6b
No known key found for this signature in database
5 changed files with 61 additions and 30 deletions

View file

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