This dataset contains sensor signals (accelerometer and gyroscope) from a phone while the subjects were doing multiple activities.
The script uses the following fles of the dataset :
- test/subject_test.txt - [2947 x 1] - the data indicating which subject is doing the experiment (test dataset)
- test/X_test.txt - [2947 x 561] - the data from the sensors (test dataset)
- test/y_test.txt - [2947 x 1] - the data indicating which activity the subject is doing (test dataset)
- train/subject_train.txt - [7352 x 1] - the data indicating which subject is doing the experiment (train dataset)
- train/X_train.txt - [7352 x 561] - the data from the sensors (train dataset)
- train/y_train.txt - [7352 x 1] - the data indicating which activity the subject is doing (train dataset)
- activity_labels.txt - [6 x 2] - the labels for the differents activities
- features.txt - [561 x 2] - the list of all the features collected by the sensors
-
First of all the script bind by column the data from the 3 files from the test dataset and do the same with the train dataset. Then it appends by row the test data at the end of the train dataset.
-
In the second step, the script only keeps the data for the mean or the standard deviation for each mesurement. I chose to keep the mesurement like meanFreq() because it's still a mean mesurement, but i removed the mesurement like "angle(X,gravityMean)" because it's an angle mesurement.
-
In the third step, the script collects the data from the activity_labels.txt file and replace the id of the activities in the original dataset
-
In the fourth step, the script collects the data from features.txt and replace the names of the columns by the name of the mesurement.
-
In the fifth step, the script creates a second, independent tidy data set with the average of each variable for each activity and each subject with the help of the plyr library
-
In the last step, the script export this newly created dataset in a text file, inside the dataset folder.
"tidy.txt" is a comma-separated-values file with a header, containing 180 observations of 81 variables.
The 180 observations comes from the combinaisons of the 6 possibles activities for each of the 30 differents subjects.
- tidy$subject (1st column) contains the ID of the subject (from 1 to 30)
- tidy$activity (2nd column) contains the activity (WALKING, WALKING_UPSTAIRS, WALKING_DOWNSTAIRS, SITTING, STANDING, LAYING)
- the last 79 columns contains the mean of each mesurement about the mean or the standard deviation selected from the original dataset.
The list of all the mesurement about the mean or the standard deviation is available just below:
- "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"
- "fBodyAcc-meanFreq()-X"
- "fBodyAcc-meanFreq()-Y"
- "fBodyAcc-meanFreq()-Z"
- "fBodyAccJerk-mean()-X"
- "fBodyAccJerk-mean()-Y"
- "fBodyAccJerk-mean()-Z"
- "fBodyAccJerk-std()-X"
- "fBodyAccJerk-std()-Y"
- "fBodyAccJerk-std()-Z"
- "fBodyAccJerk-meanFreq()-X"
- "fBodyAccJerk-meanFreq()-Y"
- "fBodyAccJerk-meanFreq()-Z"
- "fBodyGyro-mean()-X"
- "fBodyGyro-mean()-Y"
- "fBodyGyro-mean()-Z"
- "fBodyGyro-std()-X"
- "fBodyGyro-std()-Y"
- "fBodyGyro-std()-Z"
- "fBodyGyro-meanFreq()-X"
- "fBodyGyro-meanFreq()-Y"
- "fBodyGyro-meanFreq()-Z"
- "fBodyAccMag-mean()"
- "fBodyAccMag-std()"
- "fBodyAccMag-meanFreq()"
- "fBodyBodyAccJerkMag-mean()"
- "fBodyBodyAccJerkMag-std()"
- "fBodyBodyAccJerkMag-meanFreq
- "fBodyBodyGyroMag-mean()"
- "fBodyBodyGyroMag-std()"
- "fBodyBodyGyroMag-meanFreq()"
- "fBodyBodyGyroJerkMag-mean()"
- "fBodyBodyGyroJerkMag-std()"
- "fBodyBodyGyroJerkMag-meanFreq()"