CoCoQuest_import.R 944 Bytes
Newer Older
Stephanie's avatar
Stephanie committed
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
#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)