Commit 2df58055 authored by Stephanie's avatar Stephanie

setting up GUI

parents
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
)
## app.R ##
library(shiny)
library(shinydashboard)
library(leaflet)
ui<-dashboardPage(
dashboardHeader(title="CoCoVisR"),
dashboardSidebar(
sidebarMenu(
menuItem("Upload", tabName = "upload", icon =icon("upload")),
menuItem("Contolls", tabName = "controlls", icon = icon("cog")),
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Help", tabName = "help", icon = icon("book"))
)
),
dashboardBody(
tabItems(
# Upload tab content
tabItem(tabName = "upload",
h2("Upload here")
),
# Controlls tab content
tabItem(tabName = "controlls",
h2("Controlls here")
),
# Dashboard tab content
tabItem(tabName = "dashboard",
h2("This is the Dashboard"),
fluidRow(
box( title="Histogram",
#background="maroon",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250)),
box(title="Map",
status = "primary",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250)),
box(plotOutput("plot3", height = 250)),
box(plotOutput("plot4", height = 250))
#box(
# title = "Controls",
#sliderInput("slider", "Number of observations:", 1, 100, 50)
#)
)
),
# Help tab content
tabItem(tabName = "help",
h2("I am here to Help.")
)
))
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
#output$plot1 <- renderPlot({
#data <- histdata[seq_len(input$slider)]
#hist(data)
#})
##MAP
#m <- leaflet()
#m <- addTiles(m)
#x=1
#for(x in 1:2019){
#m <- addMarkers(m,lng=longitude[x], lat=latitude[x]) #addPolylines does not work
#x=x+1}
#m
}
shinyApp(ui,server)
#CoCoQuest Import
#TODO: for all Timestamps not just first and last
Sys.setenv(LANG = "en")
library(ggplot2)
library(jsonlite)
require(GGally)
library(dplyr)
library(rgl)
library(knitr)
library(scales)
library(stringi)
library(RHRV)
library(anytime)
basedir <-"D:\\Dropbox\\UNI\\BAK\\Daten\\CoCoQuest\\"
datadir <- paste(basedir, 'data/', sep = "")
plotdir <- paste(basedir, 'plots/', sep = "")
json_file <- paste(basedir, "study.json", sep="")
json_data_quest <- fromJSON(paste(json_file, sep = ""), flatten = TRUE)
cocoquest.df <- json_data_quest[["data"]]
#parsing timestamp into actual time
#json_data_quest$startTime <-as.numeric(js)
json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000
json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000
starttime <- anytime(json_data_quest$unix_starttime)
endtime <- anytime(json_data_quest$unix_endtime)
print(starttime)
print(endtime)
Sys.setenv(LANG = "en")
library(ggplot2)
library(jsonlite)
require(GGally)
library(dplyr)
library(rgl)
library(knitr)
library(scales)
library(stringi)
library(RHRV)
library(anytime)
basedir <-"D:\\Dropbox\\UNI\\BAK\\Daten\\CoConUT\\"
datadir <- paste(basedir, 'data/', sep = "")
plotdir <- paste(basedir, 'plots/', sep = "")
#loading data
json_file <- paste(basedir, "g3.json", sep="")
json_data_coco <- fromJSON(paste(json_file, sep = ""), flatten = TRUE)
coconut.df <- json_data_coco[["data"]]
#parsing timestamp into actual time
coconut.df$unix_timestamp <- as.numeric(coconut.df$timestamp)/1000
time <- anytime(coconut.df$unix_timestamp)
# optional
coconut.df$second_counter = (coconut.df$unix_timestamp - min(coconut.df$unix_timestamp))
#extracting everything into variables
lux <- as.numeric(coconut.df$light.lux)
latitude <- as.numeric(coconut.df$gps.latitude)
longitude <- as.numeric(coconut.df$gps.longitude)
bluetooth <- as.numeric(coconut.df$bluetooth.numOfBTDevices)
#print everything
print(coconut.df)
print(time)
print(longitude)
print(latitude)
print(lux)
print(bluetooth)
# getting coordinate-tuples
coordinates<-cbind(latitude,longitude)
print(coordinates)
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define server logic required to draw a histogram
server(function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fillPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
))
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