小编Yuf*_*end的帖子

R download.file,下载excel文件不起作用

我尝试使用download.file()下载excel文件.

如果我使用浏览器直接转到链接,我可以毫无问题地下载文件.

但是,使用download.file只会下载包含Excel错误的损坏文件:"您尝试打开的文件格式与文件扩展名指定的格式不同."

这是我的代码:

url <- "http://obieebr.banrep.gov.co/analytics/saw.dll?Download&Format=excel2007&Extension=.xlsx&BypassCache=true&path=%2Fshared%2fSeries%20Estad%c3%adsticas%2F1.%20Tasa%20Interbancaria%20%28TIB%29%2F1.1.TIB_Serie%20hist%C3%B3rica%20IQY&lang=es&NQUser=publico&NQPassword=publico&SyncOperation=1"
download.file(url, destfile = paste0(base_dir, "test.xls"), mode = "wb", method="libcurl")
Run Code Online (Sandbox Code Playgroud)

有任何想法如何下载此文件?

非常感谢您的帮助!

excel r

2
推荐指数
1
解决办法
1567
查看次数

闪亮的服务器:在服务器上更新数据的最佳实践是什么

我有一个闪亮的应用程序,它正在从某些文件加载​​数据。在服务器上,在不中断服务器的情况下更新这些文件的最佳方法是什么?

在网上搜索,我找到了这两个解决方案:

1) 使用reactivePoll()reactiveFileReader()

http://shiny.rstudio.com/gallery/reactive-poll-and-file-reader.html

2) 使用 reactiveValues()

在不重新启动应用程序的情况下更新闪亮的 server.R 中的数据框

values <- reactiveValues()
updateData <- function() {
  vars <- load(file = "my_data_frame.RData", envir = .GlobalEnv)
  for (var in vars)
    values[[var]] <- get(var, .GlobalEnv)
}
updateData()  # also call updateData() whenever you want to reload the data

output$foo <- reactivePlot(function() {
  # Assuming the .RData file contains a variable named mydata
  plot(values$mydata)
}
Run Code Online (Sandbox Code Playgroud)

重新加载以闪亮方式加载的文件的最佳做法是什么?

感谢您的任何意见!

shiny shiny-server

2
推荐指数
1
解决办法
2410
查看次数

标签 统计

excel ×1

r ×1

shiny ×1

shiny-server ×1