The run_analysis.R executed the following steps to get to the tidy data set:
- Downloaded and extracted datasets using read.table()
Set the working tables to current variables
featsfeatures.txt : 561 rows, 2 columns Includes the features that come from the accelerometer and gyroscope 3-axial raw signalsacsactivity_labels.txt : 6 rows, 2 columns List of activities performed when the corresponding measurements were taken and its codes (labels)testSubjecttest/subject_test.txt : 2947 rows, 1 column contains test data of 9/30 volunteer test subjects being observedtestXtest/X_test.txt : 2947 rows, 561 columns contains recorded features test datatestYtest/y_test.txt : 2947 rows, 1 columns contains test data of activities’code labelstrainSubjecttest/subject_train.txt : 7352 rows, 1 column contains train data of 21/30 volunteer subjects being observedtrainXtest/X_train.txt : 7352 rows, 561 columns contains recorded features train datatrainYtest/y_train.txt : 7352 rows, 1 columns contains train data of activities’code labels
Merging training and testing sets to create a single dataset
X(10299 rows, 561 columns) is created by merging trainX and testX using rbind() functionY(10299 rows, 1 column) is created by merging trainY and testY using rbind() functionSubject: (10299 rows, 1 column) is created by merging subject_train and testSubject using rbind() functionfilterData: (10299 rows, 563 column) is created by merging Subject, Y and X using cbind() function
Get the mean and std deviation of each measurement // Filter the activity names for the dataset
filterData(10299 rows, 88 columns) is created by subsetting mergedData, selecting only columns: subject, code and the measurements on the mean and standard deviation (std) for each measurement
Use descriptive activity names to name the activities in the data set
Change data labels the data set with appropriate descriptive variable names
Generate new tidy data frame for each variable based on the previous data set filter
From the previous data set, creates a second one that includes the average of each variable for each activity and each subject
cleanData(180 rows, 88 columns) is created by sumarizing fliterData, taking the means of each variable for each activity and each subject, after groupped by subject and activity.- Export cleanData into cleanData.txt file.