shi*_*iny 3 csv r dropbox leaflet shiny
使用下面的代码,我设法绘制了它们
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)
Run Code Online (Sandbox Code Playgroud)
这是结果
现在,在最终shiny应用程序中,我想.csv从保管箱读取文件。
library(repmis)
myfilename <- "stations.csv"
mykey <- "i9pw95ltjown2uc"
stations <- source_DropboxData(myfilename, key=mykey, sep=",", header=TRUE)
Run Code Online (Sandbox Code Playgroud)
我得到这个错误
source_DropboxData(myfilename,key = mykey,sep =“,”,header = TRUE)中的错误:未使用的参数(myfilename,key = mykey,sep =“,”,header = TRUE)
使用此链接中的答案,我尝试了
stations <- read.csv(url("https://www.dropbox.com/s/i9pw95ltjown2uc/stations.csv?dl=0"))
Run Code Online (Sandbox Code Playgroud)
我得到这个错误
read.table中的错误(文件=文件,标头=标头,sep = sep,引用=引用,:不允许重复的“ row.names”
stations <- read.csv("https://www.dropbox.com/s/i9pw95ltjown2uc/stations.csv?dl=0",
row.names=NULL)
Run Code Online (Sandbox Code Playgroud)
但str(stations)显示有1465次观测。
#'data.frame': 1465 obs. of 2 variables:
Run Code Online (Sandbox Code Playgroud)
任何建议如何.csv从保管箱读取以能够将其绘制在传单地图上的建议,将不胜感激。
使用?raw=1而不是?dl
stations <- read.csv(url("https://www.dropbox.com/s/i9pw95ltjown2uc/stations.csv?raw=1"))
> head(stations)
stations x y
1 station1 -77.2803 35.8827
2 station2 -79.1243 42.4356
3 station3 -93.4991 30.0865
4 station4 -117.6321 34.0905
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
962 次 |
| 最近记录: |