simplify code to convert factors to character

This commit is contained in:
Egeler, Paul W 2018-06-04 11:32:23 -04:00
parent 568ae05879
commit f7c1e01eff

View File

@ -64,12 +64,7 @@ REDCap_split <- function(records, metadata) {
)
# Make sure that no metadata columns are factors
metadata_factors <- sapply(metadata, inherits, "factor")
if(any(metadata_factors)) {
metadata[metadata_factors] <- lapply(metadata[metadata_factors], as.character)
}
metadata <- rapply(metadata, as.character, classes = "factor", how = "replace")
# Find the fields and associated form
fields <- metadata[