GettingCleaningData

Created: 2014-05-18 16:08
Updated: 2014-05-18 21:36
r

README.md

Getting and Cleaning Data

Course project

Description of the run_analysis.R script

The script run_analysis.R has eleven steps, these steps are also indicated in the script file using comments (#):

  1. Read data files (train and test) and merge both sets in a single object (data)
  2. Read label files (train and test) and merge both sets in a single object (label)
  3. Read subject files (train and test) and merge both sets in a single object (subject)
  4. Descriptive activity names were extracted from the activity_labels.txt file and used to reclassify the label object from activity codes into activity names
  5. The columns corresponding to means and standard deviations were located in the file features.txt. The column numbers were grouped in a vector used to select just such columns
  6. The file features.txt was also read to create feature names using nested gsub calls to elliminate punctuation form the names
  7. Interactions subjects-label were created with the interaction function
  8. Several steps were needed to create a two column data.frame called tidy that contains the activity in the first column and the subject in the second
  9. A loop adds, for each feature, a column is added to tidy containing the feature mean for each activity-subject combination
  10. The names of the columns are attached to tidy
  11. Write the tidy data.frame to the file tidyData.txt
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more