This is a code book describes the variables, the data, and any transformations or work that you performed to clean up the data.
- Original data: https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip
- Original description of the dataset: http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones
The experiments have been carried out with a group of 30 volunteers within an age bracket of 19-48 years. Each person performed six activities (WALKING, WALKING_UPSTAIRS, WALKING_DOWNSTAIRS, SITTING, STANDING, LAYING) wearing a smartphone (Samsung Galaxy S II) on the waist. Using its embedded accelerometer and gyroscope, we captured 3-axial linear acceleration and 3-axial angular velocity at a constant rate of 50Hz. The experiments have been video-recorded to label the data manually. The obtained dataset has been randomly partitioned into two sets, where 70% of the volunteers was selected for generating the training data and 30% the test data.
The sensor signals (accelerometer and gyroscope) were pre-processed by applying noise filters and then sampled in fixed-width sliding windows of 2.56 sec and 50% overlap (128 readings/window). The sensor acceleration signal, which has gravitational and body motion components, was separated using a Butterworth low-pass filter into body acceleration and gravity. The gravitational force is assumed to have only low frequency components, therefore a filter with 0.3 Hz cutoff frequency was used. From each window, a vector of features was obtained by calculating variables from the time and frequency domain. See 'features_info.txt' for more details.
- Triaxial acceleration from the accelerometer (total acceleration) and the estimated body acceleration.
- Triaxial Angular velocity from the gyroscope.
- A 561-feature vector with time and frequency domain variables.
- Its activity label.
- An identifier of the subject who carried out the experiment.
- 'README.txt'
- 'features_info.txt': Shows information about the variables used on the feature vector.
- 'features.txt': List of all features.
- 'activity_labels.txt': Links the class labels with their activity name.
- 'train/X_train.txt': Training set.
- 'train/y_train.txt': Training labels.
- 'test/X_test.txt': Test set.
- 'test/y_test.txt': Test labels.
The following files are available for the train and test data. Their descriptions are equivalent.
-
'train/subject_train.txt': Each row identifies the subject who performed the activity for each window sample. Its range is from 1 to 30.
-
'train/Inertial Signals/total_acc_x_train.txt': The acceleration signal from the smartphone accelerometer X axis in standard gravity units 'g'. Every row shows a 128 element vector. The same description applies for the 'total_acc_x_train.txt' and 'total_acc_z_train.txt' files for the Y and Z axis.
-
'train/Inertial Signals/body_acc_x_train.txt': The body acceleration signal obtained by subtracting the gravity from the total acceleration.
-
'train/Inertial Signals/body_gyro_x_train.txt': The angular velocity vector measured by the gyroscope for each window sample. The units are radians/second.
- Features are normalized and bounded within [-1,1].
- Each feature vector is a row on the text file.
For more information about this dataset contact: activityrecognition@smartlab.ws
There are 5 parts:
- 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.
- Require
reshapre2anddata.tablelibrareis. - Load both test and train data
- Load the features and activity labels.
- Extract the mean and standard deviation column names and data.
- Process the data. There are two parts processing test and train data respectively.
- Merge data set.
subject- The participant ("subject") IDactivity- The label of the activity performed when the corresponding measurements were taken
WALKING(value1)WALKING_UPSTAIRS(value2)WALKING_DOWNSTAIRS(value3)SITTING(value4)STANDING(value5)LAYING(value6)
c(1, 2, 3, 4, 5, 6)c("WALKING", "WALKING_UPSTAIRS", "WALKING_DOWNSTAIRS", "SITTING", "STANDING", "LAYING")tBodyAcc-mean()-X(column1)tBodyAcc-mean()-Y(column2)tBodyAcc-mean()-Z(column3)tBodyAcc-std()-X(column4)tBodyAcc-std()-Y(column5)tBodyAcc-std()-Z(column6)tGravityAcc-mean()-X(column41)tGravityAcc-mean()-Y(column42)tGravityAcc-mean()-Z(column43)tGravityAcc-std()-X(column44)tGravityAcc-std()-Y(column45)tGravityAcc-std()-Z(column46)tBodyAccJerk-mean()-X(column81)tBodyAccJerk-mean()-Y(column82)tBodyAccJerk-mean()-Z(column83)tBodyAccJerk-std()-X(column84)tBodyAccJerk-std()-Y(column85)tBodyAccJerk-std()-Z(column86)tBodyGyro-mean()-X(column121)tBodyGyro-mean()-Y(column122)tBodyGyro-mean()-Z(column123)tBodyGyro-std()-X(column124)tBodyGyro-std()-Y(column125)tBodyGyro-std()-Z(column126)tBodyGyroJerk-mean()-X(column161)tBodyGyroJerk-mean()-Y(column162)tBodyGyroJerk-mean()-Z(column163)tBodyGyroJerk-std()-X(column164)tBodyGyroJerk-std()-Y(column165)tBodyGyroJerk-std()-Z(column166)tBodyAccMag-mean()(column201)tBodyAccMag-std()(column202)tGravityAccMag-mean()(column214)tGravityAccMag-std()(column215)tBodyAccJerkMag-mean()(column227)tBodyAccJerkMag-std()(column228)tBodyGyroMag-mean()(column240)tBodyGyroMag-std()(column241)tBodyGyroJerkMag-mean()(column253)tBodyGyroJerkMag-std()(column254)fBodyAcc-mean()-X(column266)fBodyAcc-mean()-Y(column267)fBodyAcc-mean()-Z(column268)fBodyAcc-std()-X(column269)fBodyAcc-std()-Y(column270)fBodyAcc-std()-Z(column271)fBodyAccJerk-mean()-X(column345)fBodyAccJerk-mean()-Y(column346)fBodyAccJerk-mean()-Z(column347)fBodyAccJerk-std()-X(column348)fBodyAccJerk-std()-Y(column349)fBodyAccJerk-std()-Z(column350)fBodyGyro-mean()-X(column424)fBodyGyro-mean()-Y(column425)fBodyGyro-mean()-Z(column426)fBodyGyro-std()-X(column427)fBodyGyro-std()-Y(column428)fBodyGyro-std()-Z(column429)fBodyAccMag-mean()(column503)fBodyAccMag-std()(column504)fBodyBodyAccJerkMag-mean()(column516)fBodyBodyAccJerkMag-std()(column517)fBodyBodyGyroMag-mean()(column529)fBodyBodyGyroMag-std()(column530)fBodyBodyGyroJerkMag-mean()(column542)fBodyBodyGyroJerkMag-std()(column543)
c(1, 2, 3, 4, 5, 6, 41, 42, 43, 44, 45, 46, 81, 82, 83, 84, 85, 86, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 201, 202, 214, 215, 227, 228, 240, 241, 253, 254, 266, 267, 268, 269, 270, 271, 345, 346, 347, 348, 349, 350, 424, 425, 426, 427, 428, 429, 503, 504, 516, 517, 529, 530, 542, 543)c("tBodyAcc-mean()-X", "tBodyAcc-mean()-Y", "tBodyAcc-mean()-Z", "tBodyAcc-std()-X", "tBodyAcc-std()-Y", "tBodyAcc-std()-Z", "tGravityAcc-mean()-X", "tGravityAcc-mean()-Y", "tGravityAcc-mean()-Z", "tGravityAcc-std()-X", "tGravityAcc-std()-Y", "tGravityAcc-std()-Z", "tBodyAccJerk-mean()-X", "tBodyAccJerk-mean()-Y", "tBodyAccJerk-mean()-Z", "tBodyAccJerk-std()-X", "tBodyAccJerk-std()-Y", "tBodyAccJerk-std()-Z", "tBodyGyro-mean()-X", "tBodyGyro-mean()-Y", "tBodyGyro-mean()-Z", "tBodyGyro-std()-X", "tBodyGyro-std()-Y", "tBodyGyro-std()-Z", "tBodyGyroJerk-mean()-X", "tBodyGyroJerk-mean()-Y", "tBodyGyroJerk-mean()-Z", "tBodyGyroJerk-std()-X", "tBodyGyroJerk-std()-Y", "tBodyGyroJerk-std()-Z", "tBodyAccMag-mean()", "tBodyAccMag-std()", "tGravityAccMag-mean()", "tGravityAccMag-std()", "tBodyAccJerkMag-mean()", "tBodyAccJerkMag-std()", "tBodyGyroMag-mean()", "tBodyGyroMag-std()", "tBodyGyroJerkMag-mean()", "tBodyGyroJerkMag-std()", "fBodyAcc-mean()-X", "fBodyAcc-mean()-Y", "fBodyAcc-mean()-Z", "fBodyAcc-std()-X", "fBodyAcc-std()-Y", "fBodyAcc-std()-Z", "fBodyAccJerk-mean()-X", "fBodyAccJerk-mean()-Y", "fBodyAccJerk-mean()-Z", "fBodyAccJerk-std()-X", "fBodyAccJerk-std()-Y", "fBodyAccJerk-std()-Z", "fBodyGyro-mean()-X", "fBodyGyro-mean()-Y", "fBodyGyro-mean()-Z", "fBodyGyro-std()-X", "fBodyGyro-std()-Y", "fBodyGyro-std()-Z", "fBodyAccMag-mean()", "fBodyAccMag-std()", "fBodyBodyAccJerkMag-mean()", "fBodyBodyAccJerkMag-std()", "fBodyBodyGyroMag-mean()", "fBodyBodyGyroMag-std()", "fBodyBodyGyroJerkMag-mean()", "fBodyBodyGyroJerkMag-std()")