Commit 34aad481 by Jan Wijffels

Move the app

parent ed878e89
---
title: "Citizen Air"
runtime: shiny
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
......@@ -41,8 +41,6 @@ dashinput$srv <- fetch(services(dashinput$endpoint))
dashinput$stations <- stations(dashinput$endpoint, service = dashinput$srv)
dashinput$stations_sp <- as.SpatialPointsDataFrame(dashinput$stations)
dashinput$stations_sp <- dashinput$stations_sp[sapply(1:nrow(dashinput$stations_sp), FUN=function(idx) gIntersects(dashinput$region, dashinput$stations_sp[idx, ])), ]
```
......@@ -60,10 +58,10 @@ popups$cleaned_data <- modalDialog(
# Data {data-icon="fa-cloud-upload"}
```{r child="pages_citizenair/page01-introduction.Rmd", eval=TRUE}
```{r child="page01-introduction.Rmd", eval=TRUE}
```
# Exploreer en vergelijk {data-icon="fa-toggle-on"}
```{r child="pages_citizenair/page02-exploratory.Rmd", eval=TRUE}
```{r child="page02-exploratory.Rmd", eval=TRUE}
```
......@@ -83,7 +83,7 @@ output$uiOutput_stations <- renderLeaflet({
map <- addCircleMarkers(map = map, data = stations, radius = 5, opacity = 0.3, fillOpacity = 1, weight = 3, popup = as.character(stations$label))
if(length(userdata$nearest_station) > 0){
stations <- subset(stations, id %in% userdata$nearest_station)
map <- addPopups(map, data = stations, popup = "Dichtstbijzijnde officiële meetstation")
map <- addPopups(map, data = stations, popup = "Dichtstbijzijnd gevalideerd meetstation")
}
if(nrow(meta) > 0){
map <- addPopups(map, lng = meta$lon, lat = meta$lat, popup = "Uw meetpunten")
......@@ -171,13 +171,16 @@ renderTable({
userdata <- citizenair_userdata()
x <- as.data.table(userdata$data$phenomena)
if(nrow(x) > 0){
x <- x[, frequentie := as.numeric(difftime(timepoint, shift(timepoint, type = "lag", n = 1L), units = "mins")),
x <- x[, meetfrequentie := as.numeric(difftime(timepoint, shift(timepoint, type = "lag", n = 1L), units = "mins")),
by = list(sheet_id)]
x <- x[!is.na(frequentie), list(n = .N), by = list(sheet_id, frequentie)]
x <- x[, list(n = .N), by = list(sheet_id, meetfrequentie)]
x <- x[, pct := round(100 * n / sum(n), 1), by = list(sheet_id)]
x <- subset(x, !is.na(meetfrequentie))
x <- x[order(n, decreasing=TRUE), ]
x <- merge(x, userdata$data$meta, by = "sheet_id")
x <- as.data.frame(x)
x <- x[!duplicated(x$sheet_id), c("sheet_id", "device", "frequentie")]
x <- x[!duplicated(x$sheet_id), c("sheet_id", "device", "meetfrequentie", "n", "pct")]
x$meetfrequentie <- sprintf("elke %s minuten", round(x$meetfrequentie, 2))
}else{
x <- NULL
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment