This project aims at aggregating, simplifying and cleaning the raw data coming from the study "Human Activity Recognition Using Smartphones Dataset", version 1.0.
The raw data set contains data captured from a smartphone's accelerometer and gyroscope. The experiments have been performed with a group of 30 volounteers during different activities (sitting, walking, etc.). The result is a set of features showing acceleration, speed, etc. All features and the steps performed on the raw data set are described below in the chapter "Code Book".
The raw data set can be obtained from http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones
The functions provided by this study will perform the following modifications to the raw data and create a tidy data set:
- Merge the training and test data sets (data concerning "inertial signals" has been left out, since it is not compatible with the rest of the data)
- Only the features representing "standard deviation" and "mean" are kept in the tidy data set
- Add activity (sitting, laying, etc.) to the tidy data set - The raw data has the activities in a separate file
- Add the subject/person to each line of the tidy data set. That way each line can easily be tied to one of the 30 volounteers
- Aggregate the data per activity and subject, using the mean-function. As a result each subject will have as many lines in the file as activities, each showing the mean of all measurements for that particular subject/activity combination over the complete time series.
- To simplify usage of the tidy data set, the column headers names are adjusted. All parenthesis "()" are removed and dashes and underscores "-" "_" replaced with dots ".".
To create the tidy data set using the raw data, the function runAnalysis (included in the file "run_analysis.R") should be executed. This function expects a sub directory named "UCI HAR Dataset" in the current working directory, containing the raw data set. This sub directory will be created when extracting the zip-file "UCI HAR Dataset.zip", which can be obtained from the URL mentioned in chapter "Study Design". A new tidy dataset will be created and saved in the current working directory, with the file name "tidy.txt".
-
Activity - A charachter string indicating the current activity. One of: LAYING, SITTING, STANDING, WALKING, WALKING_DOWNSTAIRS, WALKING_UPSTAIRS
-
Subject - An integer indicating which person who performed the experiment
-
Column 3-68 - Contains numeric velocity measurements normalized to a value between [-1,1], each described by their column name using the following conventions:
-
"t" - Time series measurement (note that in the tidy data set the series has been aggregated, see Code Book)
-
"Acc" - Measurement coming from the accelerometer
-
"Gyro" - Measurement coming from the gyroscope
-
"Body"/"Gravity" - Body or Gravity measurement that were separated from the accelerometer measurement using a low pass Butterworth filter with a corner frequency of 0.3 Hz.
-
"X"/"Y"/"Z" - Denotes the axis of the measurement
-
"Jerk" - The jerk signal, derived from body acceleration and angular velocity
-
"f" - The result of applying a Fast Fourier Transform (FFT) to the measurment
-
"mean" - The average value over the complete time series for that subject and activity
-
"std" - The average standard deviation over the complete time series for that subject and activity
-
- Activity
- Subject
- tBodyAcc.mean.X
- tBodyAcc.mean.Y
- tBodyAcc.mean.Z
- tGravityAcc.mean.X
- tGravityAcc.mean.Y
- tGravityAcc.mean.Z
- tBodyAccJerk.mean.X
- tBodyAccJerk.mean.Y
- tBodyAccJerk.mean.Z
- tBodyGyro.mean.X
- tBodyGyro.mean.Y
- tBodyGyro.mean.Z
- tBodyGyroJerk.mean.X
- tBodyGyroJerk.mean.Y
- tBodyGyroJerk.mean.Z
- tBodyAccMag.mean
- tGravityAccMag.mean
- tBodyAccJerkMag.mean
- tBodyGyroMag.mean
- tBodyGyroJerkMag.mean
- fBodyAcc.mean.X
- fBodyAcc.mean.Y
- fBodyAcc.mean.Z
- fBodyAccJerk.mean.X
- fBodyAccJerk.mean.Y
- fBodyAccJerk.mean.Z
- fBodyGyro.mean.X
- fBodyGyro.mean.Y
- fBodyGyro.mean.Z
- fBodyAccMag.mean
- fBodyBodyAccJerkMag.mean
- fBodyBodyGyroMag.mean
- fBodyBodyGyroJerkMag.mean
- tBodyAcc.std.X
- tBodyAcc.std.Y
- tBodyAcc.std.Z
- tGravityAcc.std.X
- tGravityAcc.std.Y
- tGravityAcc.std.Z
- tBodyAccJerk.std.X
- tBodyAccJerk.std.Y
- tBodyAccJerk.std.Z
- tBodyGyro.std.X
- tBodyGyro.std.Y
- tBodyGyro.std.Z
- tBodyGyroJerk.std.X
- tBodyGyroJerk.std.Y
- tBodyGyroJerk.std.Z
- tBodyAccMag.std
- tGravityAccMag.std
- tBodyAccJerkMag.std
- tBodyGyroMag.std
- tBodyGyroJerkMag.std
- fBodyAcc.std.X
- fBodyAcc.std.Y
- fBodyAcc.std.Z
- fBodyAccJerk.std.X
- fBodyAccJerk.std.Y
- fBodyAccJerk.std.Z
- fBodyGyro.std.X
- fBodyGyro.std.Y
- fBodyGyro.std.Z
- fBodyAccMag.std
- fBodyBodyAccJerkMag.std
- fBodyBodyGyroMag.std
- fBodyBodyGyroJerkMag.std