My problem relates to translation of accented characters in R/Shiny - I tried to employ the solution discussed here but ran into a frustrating exception:
Within RStudio; if I highlight all lines of the code below and then press Ctrl+Enter (Run-Selected-Lines) I get the expected output of "ooo".
However if I press 'Run App' (as part of a project) I instead get "ǒoo" - i.e. the first character doesn't get mapped.
library(shiny)
ui <- fluidPage()
server <- function(input, output) {
charactermap = list('ǒ'='o', 'ô'='o', 'ø'='o')
removeaccents <- function(x) {
corrected <- chartr(paste(names(charactermap), collapse=''),
paste(charactermap, collapse=''),
x)
return(corrected)
}
print(removeaccents("ǒôø"))
}
# Run the application
shinyApp(ui = ui, server = server)
This seems to happen with only a small number of characters I am interested in - any ideas why this may be happening and how to fix it please???