In what follows, the code is to described in a step-by-step fashion:
Downloading the data using "download.file" function. Then:
- unzip the file into folder "dataset"
- leave the unzipped folder in the working directory and
- keep the structure of the folder unchanged.
Individual files are read-in (using read.table) and merged using cbind and rbind respectively.
Features are stored in data.frame "X", response in array "y". Data.frame "subject_ID" contains individual subjects.
After feature-names are loaded in from "features.txt", only features that have "mean()" or "std()" in their names are kept in.
Library sqldf is used to left-join activity labels to the response 'y'.
The scoringDataSet is a composed from selected features and the response
ScoringDataSet is grouped by subject and response and for each group and average is computed for each of the group.