Saturday, April 7, 2018

r - What do I do when Shiny won't read my files?

My Shiny app works on my local computer, but when I upload it to the shinyapps.io server, I get an error message that says:




Warning in gzfile(file, "rb") : cannot open compressed file
'./data/treemap_master.rds', probable reason 'No such file or
directory' Error in value[3L] : cannot open the connection

Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted




You can find the full github repository at: https://github.com/ethantenison/UWATX_Shiny_App



This app is supposed to be uploaded to the Shinyapps linux server. I've made sure that all of the files use relative paths, that the app.R file is inside the directory containing all my files, and I've updated all of my packages including R itself.



library(devtools)
library(shinydashboard)

library(shiny)
library(V8)
library(shinyjs)
library(rintrojs)
library(highcharter)
library(RColorBrewer)
library(htmlwidgets)
library(dplyr)
library(stringr)
library(magrittr)

library(viridis)
library(viridisLite)
library(readr)
library(tidyr)
library(leaflet)
library(treemap)
library(leaflet.extras)
library(sf)

# ------------------------------- #

# ------------------------------- #
# ------------------------------- #
# ------------SECTION:----------- #
# ----Reference Data & Styles---- #
# ------------------------------- #
# ------------------------------- #
# ------------------------------- #

# IMPORT MAP STYLES
blank <- "https://api.mapbox.com/styles/v1/mrw03b/cjjd6srrl7ot42so3cbjxn6ot/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibXJ3MDNiIiwiYSI6IlYwb2FiOWcifQ.RWUm2a87fEC9XrDxzvZKKg"

northstar <- "https://api.mapbox.com/styles/v1/mrw03b/cj48wz0xh15td2st5hcmeqmsv/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibXJ3MDNiIiwiYSI6IlYwb2FiOWcifQ.RWUm2a87fEC9XrDxzvZKKg"
map_attr <- "© Mapbox | Map © United Way of Greater Austin"

full_zips_list <- "78705|78617|78641|78645|78652|78653|78660|78701|78702|78703|78704|78719|78721|78722|78723|78724|78725|78727|78728|78730|78731|78732|78733|78734|78735|78736|78738|78739|78741|78742|78743|78744|78745|78746|78747|78748|78749|78750|78751|78752|78753|78754|78756|78757|78758|78759|78654|78610|78621|78615|78669|78737|78620|78726"

filter_out <- "78712|78743"

treemap_master <- read_rds('./data/treemap_master.rds') %>%
ungroup() %>%
mutate(age = as.character(age))


#TREEMAP DATA - ZIP & NEEDS
needs_zip_treemap <- read_rds('./data/needs_zip_treemap.rds') %>%
ungroup() %>%
janitor::clean_names() %>%
mutate(day = as.character("01"),
month = as.character("01")) %>%
unite(date, c("year", "month", "day"), sep = "-") %>%
mutate(date = as.Date(date, "%Y-%m-%d")) %>%
rename(year = date)


travis_dl <- read_rds('./data/data_4_download.rds')

travis <- read_rds('./data/data_4_analysis.rds') %>%
filter(!str_detect(zipcode, filter_out)) %>%
group_by(Year, measure) %>%
mutate(rank = dense_rank(desc(value))) %>%
ungroup()

travis_summ <- read_rds('./data/summ211.rds')


travis_county_sf <- read_rds('./data/traviscounty_boundary.rds')



The app is supposed to look something like this: https://uwatx.shinyapps.io/211Explorer/



You can find the full error message here:
https://uwatx.shinyapps.io/UWATX_Shiny_App/

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...