I am trying to use an animated slidebar to show conflict events per year since 1997. When It returns an Error: 'arg' must be NULL or a character vector.
I don't know what or where is the problem.
Here is the code
title: "Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
library(flexdashboard)
library(shiny)
library(DT)
library(dygraphs)
library(xts)
library(leaflet)
library(rgdal)
Column {data-width=200 .sidebar}
sliderInput("Year",
"DATE:",
min = as.Date("1997","%Y"),
max = as.Date("2020","%Y"),
value=as.Date("1997-01-01"),
step = 365,
timeFormat="%Y",
animate = T)
c_events <- reactive({
filter(data$lat, data$long, input$Year)
})
Column {data-width=650}
Map
data <- read.csv("Conflict_Kenya.csv")
sums <- read.csv("Conflict_Sums.csv")
data$long <- as.numeric(data$long)
data$lat <- as.numeric(data$lat)
data.SP <- SpatialPointsDataFrame(data[,c(5,6)], data[,-c(5,6)])
c_events <- reactive({
filter(data$lat, data$long, input$Year)
})
renderLeaflet({
c_events() %>%
leaflet() %>%
addProviderTiles(providers$CartoDB.DarkMatter) %>%
addCircleMarkers(radius = 1.3, color = "red", stroke = FALSE, fillOpacity = 0.6)
})
Column {data-width=350}
Timetrend
sums <- read.csv("Conflict_Sums.csv")
dygraph(sums)