This repository contains the source code for analyzing raw data of sensors in smartwatches(Android Wear).
library("utils", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
library("ggplot2", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
library("signal", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
library("moments", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
library("quantmod", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
library("pracma", lib.loc="/Library/R/3.3/library")
library("plotly", lib.loc="/Library/R/3.3/library")
library("caret", lib.loc="~/Library/R/3.3/library")
library("methods", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
data<-read.csv("./walking/watch1_sensor_data.txt") # walking data data2<-read.csv("./running/watch2_sensor_data.txt") # running data
createPlot(data, 8, "linear_accel", FALSE,"1003")
createPlot(data, 8, "linear_accel", FALSE,"1003",TRUE,1000,8000)
createPlot(data, 8, "linear_accel", FALSE,"1003",TRUE,1000,8000, type = 2)
foldername <- "./walking" extracted_features_walking <- feature_extraction(foldername, 8, 150, 50, "walking") foldername <- "./running" extracted_features_running<- feature_extraction(foldername, 8, 150, 50, "running") data<-rbind(extracted_features_running, extracted_features_walking) print(colnames(data[5:length(data)])) # print feature list
feature_name <- "Linearaccel_entropy_avg" plotDist(data, feature_name, "bin") plotDist(data, feature_name, "density")
model <- getModelBy(data, ML_method = "J48")
foldername <- "./walking" filename <- list.files(foldername) filename <- paste(foldername,"/",filename[1],sep="") print(paste("traget file : ",filename)) detectEventBy(filename, 8, 150, 50, model, "walking")
t<-detectEventByWindow(filename, 8, 150, 50, model) print(paste("recognition result :", t))