In this project we clean up and summarize data from the Human Activity Recognition Using Smartphones Data Set into a tidy dataset.
The run_analysis.R script executes in the following sequence:
- Reads in all the reference data consisting of column names and activity names.
- Reads in the test data set, adds test subjects, labels the columns and activity names as appropriate.
- Reads in the training data set, adds test subjects, labels the columns and activity names as appropriate.
- Merges the test and training data sets into one data frame.
- Selects the mean and the standard deviation measures.
- Summarizes an average for each selected measure by subject and activity name.
- Writes out the final result to
summary.txt
.
Instructions and notes:
- Use
source('run_analysis.R')
to execute the analysis script. - To read
summary.txt
back into the environment useread.table("summary.txt", header = TRUE)
. - For details on the contents of summary.txt review the codebook provided.
- The resultant data is tidy because each observation is a row and each variable is a column.
Many thanks to David Hood for his clarifications on the assignment's instructions.