Skip to content

Commit

Permalink
rm warning supression, and convert all cols to chr before reclassing
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbarks committed Feb 22, 2024
1 parent c46ff4e commit 3f4d02e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/reclass_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @return
#' The dataset with columns reclassed to match the data dictionary
#'
#' @importFrom dplyr `%>%`
#' @importFrom dplyr `%>%` mutate across everything
#' @export reclass_data
reclass_data <- function(data,
dict,
Expand All @@ -24,6 +24,7 @@ reclass_data <- function(data,
check_dict <- valid_dict(dict)

data %>%
mutate(across(everything(), as.character)) %>%
reclass(dict, "Numeric", format_date, format_time, format_datetime) %>%
reclass(dict, "Date", format_date, format_time, format_datetime) %>%
reclass(dict, "Time", format_date, format_time, format_datetime) %>%
Expand All @@ -50,9 +51,9 @@ reclass <- function(data, dict, type, format_date, format_time, format_datetime)
out <- data

for (var in vars_focal) {
data[[var]] <- suppressWarnings(fn_class(data[[var]]))
out[[var]] <- fn_class(out[[var]])
}

return(data)
return(out)
}

0 comments on commit 3f4d02e

Please sign in to comment.