Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephanie Wegscheidl
cocoVisR
Commits
5d69fcdb
Commit
5d69fcdb
authored
Aug 02, 2018
by
Stephanie Wegscheidl
Browse files
work around getting data
parent
592039b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
dashboard/server.R
View file @
5d69fcdb
#
# 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
)
library
(
jsonlite
)
...
...
@@ -25,8 +17,62 @@ server <- function(input, output) {
coconut.df
<<-
json_data_coco
[[
"data"
]]
lastCoConUT
<<-
inFile
$
name
print
(
"coconut:"
)
print
(
coconut.df
)
if
(
is.null
(
coconut.df
$
timestamp
)){}
else
{
unixTime
<<-
coconut.df
$
timestamp
}
if
(
is.null
(
coconut.df
$
gps.latitude
)){}
else
{
latitude
<<-
coconut.df
$
gps.latitude
}
if
(
is.null
(
coconut.df
$
gps.longitude
)){}
else
{
longitude
<<-
coconut.df
$
gps.longitude
}
if
(
is.null
(
coconut.df
$
gps.speed
)){}
else
{
speed
<<-
coconut.df
$
gps.speed
}
if
(
is.null
(
coconut.df
$
gps.accuracy
)){}
else
{
gpsAcc
<<-
coconut.df
$
gps.accuracy
}
if
(
is.null
(
coconut.df
$
light.lux
)){}
else
{
lux
<<-
coconut.df
$
light.lux
}
if
(
is.null
(
coconut.df
$
acc.coordinates
)){}
else
{
accCoord
<<-
coconut.df
$
acc.coordinates
}
if
(
is.null
(
coconut.df
$
acc.accuracy
)){}
else
{
accAcc
<<-
coconut.df
$
acc.accuracy
}
if
(
is.null
(
coconut.df
$
bluetooth.numOfBTDevices
)){}
else
{
bluetooth
<<-
coconut.df
$
bluetooth.numOfBTDevices
}
if
(
is.null
(
coconut.df
$
ble.bpm
)){}
else
{
bleBpm
<<-
coconut.df
$
ble.bpm
}
if
(
is.null
(
coconut.df
$
ble.bpmlist
)){}
else
{
bleBpmList
<<-
coconut.df
$
ble.bpmlist
}
if
(
is.null
(
coconut.df
$
ble.hrv
)){}
else
{
bleHrv
<<-
coconut.df
$
ble.hrv
}
if
(
is.null
(
coconut.df
$
ble.hrvlist
)){}
else
{
bleHrvList
<<-
coconut.df
$
ble.hrvlist
}
if
(
is.null
(
coconut.df
$
activity.name
)){}
else
{
activityName
<<-
coconut.df
$
activity.name
}
if
(
is.null
(
coconut.df
$
activity.confidence
)){}
else
{
activityConf
<<-
coconut.df
$
activity.confidence
}
if
(
is.null
(
coconut.df
$
screen.status
)){}
else
{
screenstatus
<<-
coconut.df
$
screen.status
}
if
(
is.null
(
coconut.df
$
interaction.touch
)){}
else
{
touch
<<-
coconut.df
$
interaction.touch
}
# setting the table style
datatable
(
cbind
(
coconut.df
),
...
...
@@ -41,6 +87,8 @@ server <- function(input, output) {
class
=
'cell-border stripe'
)
)
})
output
$
lastLoadedNut
<-
renderText
({
...
...
@@ -59,8 +107,7 @@ server <- function(input, output) {
#loading CoCoQuest data
json_data_quest
<<-
fromJSON
(
paste
(
inFile
$
datapath
,
sep
=
""
),
flatten
=
TRUE
)
#print("json_data_qest")
#print(json_data_quest)
lastCoCoQuest
<<-
inFile
$
name
json_data_quest
$
unix_starttime
<-
as.numeric
(
json_data_quest
$
startTime
)
/
1000
...
...
@@ -70,7 +117,6 @@ server <- function(input, output) {
#unix parsed
dat
<-
do.call
(
rbind
,
json_data_quest
$
tasks
$
data
)
endtimes
<<-
c
(
anytime
(
dat
$
endtime
/
1000
))
...
...
@@ -97,12 +143,7 @@ server <- function(input, output) {
cbind
(
tasks
,
endtimes
),
options
=
list
(
searching
=
FALSE
,
#autoWidth = TRUE,
rownames
=
TRUE
,
#scroller = TRUE,
#scrollX = TRUE,
# scrollY = "500px",
class
=
'cell-border stripe'
)
)
...
...
@@ -125,36 +166,54 @@ server <- function(input, output) {
#TODO: Getting HEADER out of json to select it
#Not sure if so smart but it should work that way
output
$
input_hist_x
<-
renderUI
({
selectInput
(
"in1"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in1"
,
"x-axis:"
,
cbind
(
"unixTime"
,
"longitude"
,
"latitude"
,
"speed"
,
"gps.acc"
,
"lux"
,
"light.acc"
,
"acc.coordinates"
,
"acc.acc"
,
"bluetooth"
,
"ble.bpm"
,
"ble.bpmlist"
,
"ble.hrv"
,
"ble.hrvlist"
,
"activity.name"
,
"acctivity.confidence"
,
"screen.status"
,
"touch"
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_hist_y
<-
renderUI
({
selectInput
(
"in1"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in2"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_time_x
<-
renderUI
({
selectInput
(
"in1"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in3"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_time_y
<-
renderUI
({
selectInput
(
"in1"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in4"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_map_x
<-
renderUI
({
selectInput
(
"in1"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in5"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_map_y
<-
renderUI
({
selectInput
(
"in1"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in6"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_line_x
<-
renderUI
({
selectInput
(
"in1"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in7"
,
"x-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
output
$
input_line_y
<-
renderUI
({
selectInput
(
"in1"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
if
(
is.null
(
input
$
nut
))
return
(
NULL
)
selectInput
(
"in8"
,
"y-axis:"
,
as.list
(
coconut.df
),
multiple
=
TRUE
,
selectize
=
TRUE
)
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment