title | author | date | output |
---|---|---|---|
CodeBook |
Don Resnik |
April 11, 2016 |
html_document |
knitr::opts_chunk$set(echo = TRUE)
if(file.exists("myFile.Rda")){
load("myFile.Rda")}
Combine the rows (rbind) of:
-
subject train and test
-
Y train and test (activity data)
-
X train and test (result data)
The subject and activity data are shown in a single talbe (cbind). The data for the train and test results is shown in the table below that.
str(subjectActivity)
head(subjectActivity)
str(dataTrainTest)
Use regex to extract the 'mean' and 'sd' columns from the 'features'. Notice that rows are skipped that don't hold mean or sd values. This is derived from mapping the names in the features list to the id in the 'Vxx' column names.
str(features)
head(features)
str(featuresMeanSdToMatch)
head(featuresMeanSdToMatch,8)
Filter out the feature columns for 'mean' and 'sd' values
str(subjectActivityDataArrange)
head(subjectActivityDataArrange)
Map the activity names to the activity column and map feature names to the 'Vxx' columns
str(subjectActivityNameMerge)
head(subjectActivityNameMerge)
5. 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.
str(summaryData)
head(summaryData)