Description
30 subjects performed six activities wearing a smartphone. Data was collected on the 3-axial linear acceleration and angular velocity. The 30 subjects were placed in 2 sets, a train group and a test group.
For full description of the data…
http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones
To get the raw data…
https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip
Files
- readme.md
- codebook.md - description the variables and steps taken to transform the raw data
- run_analysis.r - the script to complete the transformation
- finalTidyDataset.txt - final output file
Instructions for Script
- Create a folder within your working directory called data
- Download the raw data from the link above into your data folder
- Install the reshape2 package into R
- Execute the run_analysis script
Overview of steps occurring within the run_analysis script
-
Read in files for feature, activity labels, subjectID, activityID and measurement data for both the train and test datasets
-
Renamed the columns in the train and test datasets to the appropriate feature names from the features.txt file
-
Subsetted each dataset to only include column measurements that included a mean "mean()" or standard deviation "std()" measurement
-
Combined the subjectID, activityID and the subsetted data together using cbind for the train and the test datasets
-
Combined the newly created datasets to gather to create one master dataset
-
Cleaned up the column names by removing unneeded values
-
Matched the activity name to the activity ID and added activity name to the dataset
-
Re-ordered the dataset to a cleaner layout and removed unneeded columns to create the main "Tidy" dataset
-
Reshaped the Tidy dataset to create a new Tidy set with averages of the mean and std by subject and activity
-
exported this final table out to a text file.