gpt4 book ai didi

r - 当 Shiny 不读取我的文件时,我该怎么办?

转载 作者:行者123 更新时间:2023-12-04 09:50:39 25 4
gpt4 key购买 nike

我的 Shiny 应用程序在我的本地计算机上运行,​​但是当我将它上传到 Shinyapps.io 服务器时,我收到一条错误消息:

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



您可以在以下位置找到完整的 github 存储库: https://github.com/ethantenison/UWATX_Shiny_App

这个应用程序应该上传到 Shinyapps linux 服务器。我确保所有文件都使用相对路径,app.R 文件位于包含我所有文件的目录中,并且我已经更新了我的所有包,包括 R 本身。
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 <- "© <a href='https://www.mapbox.com/map-feedback/'>Mapbox</a> | Map © <a href='http://www.unitedwayaustin.org/our-work/2gen/'>United Way of Greater Austin</a>"

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')


该应用程序应该看起来像这样: https://uwatx.shinyapps.io/211Explorer/

您可以在此处找到完整的错误消息:
https://uwatx.shinyapps.io/UWATX_Shiny_App/

最佳答案

我发现了问题! Linux 只读取小写的文件扩展名。当我最初保存对象时,我使用了扩展名 .RDS。即使 app.R 文件使用 .rds 调用对象,也没关系。现在完美运行。

关于r - 当 Shiny 不读取我的文件时,我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57597918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com