Repository contains next files:
- CodeBook.md - Code book descroption file fro output dataset variables
- README.md - this document with run flow description.
- run_analysis.R - R script for performing data analysis and produce output dataset as file.
Script requires packages:
- plyr
- LaF
So you need to install these packages:
install.packages("plyr")
install.packages("LaF")
To run analysis script do the following steps:
- set working directory in place where run_analysis.R is located
- run following command in R console
source("run_analysis.R")
- After run variable "resultData" will contains resultind data set. Also data set will be written to file defined in "outputTable" variable (function write.table() is used with row.name=FALSE)
Read CodeBook.md for result variables description and data manipulation.
Scripts performs actions according to next algorithm:
- Download and unzip data if it's not downloaded yet.
- Read metadata: activity map, features list
- define variables to be read from main dataset (mean and standard deviation of features)
- Read train dataset, merge with subject and action columns and provide corect names.
- Read test dataset, merge with subject and action columns and provide corect names.
- Combine datasets from item 4 and 5 using rowbind to obtain resulting dataset.
- Calculate mean for all features variables from dataset by each subject and action.
- Save the result from item 8 into output dataset named "resultData" and write to file (by default - "data/output.txt").