GettingandCleaningData_project

Created: 2014-05-19 18:45
Updated: 2014-05-20 01:26
r

README.md

Getting and Cleaning Data project

run_analysis.R

The cleanup script (run_analysis.R) does the following:

  1. Merges the training and the test sets to create one data set.
  2. Extracts only the measurements on the mean and standard deviation for each measurement.
  3. Uses descriptive activity names to name the activities in the data set
  4. Appropriately labels the data set with descriptive activity names.
  5. Creates a second, independent tidy data set with the average of each variable for each activity and each subject

Generate Dataset

Checkout the repo, and run the script run_analysis.R.

source("run_analysis.R")

step 1. Merges the training and the test sets to create one data set. Read test and training files and combine X, Y and subject data sets by using rbind() function

step 2. Extracts only the measurements on the mean and standard deviation for each measurement. Read features file and select those features that contain "mean" or "std" by using grep() function and save these features as a variable called "good_features".

step 3. Uses descriptive activity names to name the activities in the data set.

step 4. Appropriately labels the data set with descriptive activity names. And write an file called "tidy1.txt", a 10299x68 data frame. str(processed) shows the "processed" data frame structure before write into a txt file and a csv file.

step 5. Creates a 2nd, independent tidy data set with the average of each variable for each activity and each subject. And write an file called "tidy2.txt", a 180x68 data frame. str(result) shows the "result" data frame structure before write into a txt file and a csv file.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more