Hi everyone,
I'm new to Shiny and having some problematic behavior with my first app. Thank you in advance for your help.
I've created a simple app that allows me to call a complex scoring algorithm for a standardized assessment of child data. My colleague created a package that processes the raw data and generates various composite scores. https://github.com/marcus-waldman/credi
Knowing that many non-R users are going to want to use this, I wanted to create a simple Shiny app that allows users to upload their data and download the processed results. Conceptually it does the following:
- User inputs a CSV with raw scores
- subset CSV with only relevant variables so that it can be fed into the scoring package
- generate processed scores with scoring package
- merge the processed scores with the uploaded dataset
- provide a download link for the processed files
I've partially accomplished this here: https://credi.shinyapps.io/credi/ It works with many of my files, but I'm trouble with some (but not all) CSVs that I upload. Oddly, it works perfectly in my R Studio IDE, but once deployed is when I start to have issues.
I understand that the trouble I am having is due to character encodings in some of the csvs that I am uploading (it breaks if the csv has accented characters (e.g. á, é, Ó)). Originally I had simply:
rawdat <- read.csv(inFile$datapath, header = TRUE, sep = ",")
I have tried to fix this by adding encode = "UTF-8" but now I am getting an error
Warning: Error in gsub: input string 2 is invalid UTF-8
I assume this is related to the special characters that are not being understood when I define the encoding. Is there any workaround to this?
I can't post CSVs here, but if you want a reproducible example, I am happy to provide one.
Thanks again,
Jonathan