The run_analysis.R script performs the data preparation and then followed by the 5 steps required as described in the course project's definition.
-
Download the dataset
- Dataset downloaded and extracted under the folder called
UCI HAR Dataset
- Dataset downloaded and extracted under the folder called
-
Assign each data to variables
features<-features.txt: 561 rows, 2 columns
The features selected for this database come from the accelerometer and gyroscope 3-axial raw signals tAcc-XYZ and tGyro-XYZ.activities<-activity_labels.txt: 6 rows, 2 columns
List of activities performed when the corresponding measurements were taken and its codes (labels)subject_test<-test/subject_test.txt: 2947 rows, 1 column
contains test data of 9/30 volunteer test subjects being observedx_test<-test/X_test.txt: 2947 rows, 561 columns
contains recorded features test datay_test<-test/y_test.txt: 2947 rows, 1 columns
contains test data of activities'code labelssubject_train<-test/subject_train.txt: 7352 rows, 1 column
contains train data of 21/30 volunteer subjects being observedx_train<-test/X_train.txt: 7352 rows, 561 columns
contains recorded features train datay_train<-test/y_train.txt: 7352 rows, 1 columns
contains train data of activities'code labels
-
Merges the training and the test sets to create one data set
X(10299 rows, 561 columns) is created by mergingx_trainandx_testusing rbind() functionY(10299 rows, 1 column) is created by mergingy_trainandy_testusing rbind() functionSubject(10299 rows, 1 column) is created by mergingsubject_trainandsubject_testusing rbind() functionMerged_Data(10299 rows, 563 column) is created by mergingSubject,YandXusing cbind() function
-
Extracts only the measurements on the mean and standard deviation for each measurement
TidyData(10299 rows, 88 columns) is created by subsettingMerged_Data, selecting only columns:subject,codeand the measurements on themeanand standard deviation (std) for each measurement
-
Uses descriptive activity names to name the activities in the data set
- Entire numbers in
codecolumn of theTidyDatareplaced with corresponding activity taken from second column of theactivitiesvariable
- Entire numbers in
-
Appropriately labels the data set with descriptive variable names
codecolumn inTidyDatarenamed intoactivities- All
Accin column's name replaced byAccelerometer - All
Gyroin column's name replaced byGyroscope - All
BodyBodyin column's name replaced byBody - All
Magin column's name replaced byMagnitude - All start with character
fin column's name replaced byFrequency - All start with character
tin column's name replaced byTime
-
From the data set in step 4, creates a second, independent tidy data set with the average of each variable for each activity and each subject
FinalData(180 rows, 88 columns) is created by sumarizingTidyDatataking the means of each variable for each activity and each subject, after groupped by subject and activity.- Export
FinalDataintoFinalData.txtfile.