【发布时间】:2016-06-26 05:00:15
【问题描述】:
我想在地图上绘制 4 个站点。可以下载the data from here.
使用下面的代码,我设法绘制了它们
library(shiny)
library(leaflet)
stations <- read.csv("~path/stations.csv")
ui <- bootstrapPage(
tags$style(type = "text/css", "html, body {width:100%;height:100%}"),
leafletOutput("map", width = "100%", height = "100%"))
server <- function(input, output) {
output$map <- renderLeaflet({
leaflet(stations) %>%
addProviderTiles("Esri.WorldTopoMap") %>%
addCircleMarkers(~x,~y)
})
}
shinyApp(ui, server)
这是结果
现在,在最终的shiny 应用程序中,我想从保管箱中读取.csv 文件。
按照method described in this link,我尝试了以下
library(repmis)
myfilename <- "stations.csv"
mykey <- "i9pw95ltjown2uc"
stations <- source_DropboxData(myfilename, key=mykey, sep=",", header=TRUE)
我收到了这个错误
source_DropboxData(myfilename, key = mykey, sep = ",", header = TRUE) 中的错误: 未使用的参数 (myfilename, key = mykey, sep = ",", header = TRUE)
使用the answer in this link,我试过了
stations <- read.csv(url("https://www.dropbox.com/s/i9pw95ltjown2uc/stations.csv?dl=0"))
我收到了这个错误
read.table 中的错误(file = file,header = header,sep = sep,quote = quote,:不允许重复的 'row.names'
stations <- read.csv("https://www.dropbox.com/s/i9pw95ltjown2uc/stations.csv?dl=0",
row.names=NULL)
但str(stations) 显示它有 1465 个观察值。
#'data.frame': 1465 obs. of 2 variables:
任何关于如何从保管箱中读取.csv 以便能够将其绘制在传单地图上的建议将不胜感激。
【问题讨论】:
标签: r csv shiny leaflet dropbox