Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
Latest commit
78 lines (73 loc) · 1.93 KB
/
Copy pathapp.R
File metadata and controls
78 lines (73 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
library(shiny)
library(MapboxGL)
library(reactR)
library(shinydashboard)
library(DT)
taco_joints<-data.frame(
name= c("Tyson's Tacos", "Torchy's Tacos", "Veracruz All Natural Food Truck", "Papalote Taco House", "Tacodeli"),
lat= c(30.309630, 30.245420, 30.257940, 30.243570, 30.258467),
long= c(-97.715240, -97.751590, -97.726030, -97.781850, -97.787582)
)
taco_features<- apply(taco_joints, 1, function(row) {
component("Feature", list(
properties=list(name=row[['name']]),
coordinates=list(row[['long']], row[['lat']])
))
})
ui<- dashboardPage(
dashboardHeader(disable=TRUE),
dashboardSidebar(disable=TRUE),
dashboardBody(
fluidRow(
box(
width=12,
tags$h3("The Best Tacos in Austin according to Caitlin Hudon")
)
),
fluidRow(
box(
width=8,
solidHeader=TRUE,
MapboxGLOutput('widgetOutput')
),
box(
width=4,
DTOutput("taco_joints")
)
)
)
)
server<-function(input, output, session) {
output$taco_joints<- renderDT(taco_joints)
output$widgetOutput<- renderMapboxGL(
MapboxGL(
React$Map(
accessToken="pk.eyJ1IjoiYWxhbmRpcGVydCIsImEiOiJjamUydnEzc2s2bjFhMnFwMHFna3dkZ2plIn0.3bGyNVqMXQmNLldoigHPMw",
style="mapbox://styles/mapbox/streets-v11",
containerStyle=list(
height="500px",
width="100%"
),
center= c(-97.7431, 30.2672),
zoom=list(12),
component(
"Layer",
append(
list(
type="symbol",
id="marker",
layout=list(
`icon-image`="restaurant-15",
`icon-size`=2,
`text-field`='{name}',
`text-offset`=list(0,-2.5)
)
),
taco_features[input$taco_joints_rows_current]
)
)
)
)
)
}
shinyApp(ui, server)