I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I\'ve created them myself on Windows. Unfortunately, I don\'t have access
Another option using dplyr's mutate_if:
fix_encoding <- function(x) {
Encoding(x) <- "latin1"
return(x)
}
data <- data %>%
mutate_if(is.character,fix_encoding)
And for factor variables that have to be recoded:
fix_encoding_factor <- function(x) {
x <- as.character(x)
Encoding(x) <- "latin1"
x <- as.factor(x)
return(x)
}
data <- data %>%
mutate_if(is.factor,fix_encoding_factor)