High Level
- Merges the training and the test sets to create one data set.
- Extracts only the measurements on the mean and standard deviation for each measurement.
- Uses descriptive activity names to name the activities in the data set
- Appropriately labels the data set with descriptive activity names.
- Creates a second, independent tidy data set with the average of each variable for each activity and each subject.
Process
- Loads the reshape2 library as its need to use the methods melt and dcast and hence need to make sure we have reshape2
- Sets the file name
- Downloads the file
- Unzips the file
- Now READ all the files as data frames
- Merges the training and the test sets for the X to create one data set.
- Skips the first column in the Features and just get the indices of the rows in the 2nd column that contains the mean or standard deviation and stores then as list
- Gets all the activities by doing a row bind
- Creates feature names list by removing "()" apply to the measurements to rename labels.gsub does a global substitute
- Combine test and train of subject data
- Combines the subject, activity, and mean and std only data set to create ready go measurements
- Creates a molten data frame and then get the mean of the measurements using dcast and finally write a tidy data file