I have a Shiny app where you can upload a file, and the data is then processed and relevant outputs appear. This is working totally fine locally. However, I've deployed it with shinyapps.io and now although the app appears fine at first, clearly something is going wrong with the data processing.
I use data.table::fread()
for .csv files and readxl::read_excel
for excel files. If you upload a .csv file, the app grays out, whereas if you upload an excel file, the outputs appear but basically blank as if no data is there.
The key errors in the logs are all like this:
Warning in grepl(pattern, vector, ignore.case = ignore.case, fixed = fixed) : input string 2 is invalid in this locale
I've found a few relevant posts, although not specifically about different behaviour on deployed apps. Looking at this one, it seems like this is sometimes to do with different script types? One of the elements in the data is coordinates so maybe they are causing problems. For e.g. they might look like this:
E025° 50' 38"E
I have different outputs for Sys.locale()
. Locally I get
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
On the deployed app it's
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
I've tried using useBytes = TRUE
as a gsub()
and grepl()
argument but then it causes other errors later on or else seems to make no difference.
Thanks for your help!