This is the README.md file for the Coursera course project for the course "Getting and Cleaning Data" https://class.coursera.org/getdata-034
This project consists of the following files:
- README.md - this file describing the project
- code_book.md - code book file describing the variables in the data produced by running this code
- run_analysis.R - the file containing the R script
The purpose of this script is to create a tidy data set from data collected from the accelerometers from the Samsung Galaxy S smartphone as described in this website: http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones
The script has been designed to work solely on the data set downloaded from this URL: https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip
This script requires the dplyr R package to run.
This is the main function of the script. By default this function assumes that the workspace in which it is running contains the UCI_HAR_Dataset. Alternatively the path to the data set directory may be specified as a parameter. The steps this script follows are:
- Read the files from the data set containing the activity and features labels
- Reads the test and train data files
- Creates tidy test and train data sets by combining the separated subject, activity and data files
- Merges the test and train data sets into one
- Extracts into a subset data set from the combined data set only those columns which include the mean and standard deviation values
- Groups the data set by data set type ("train", "test"), by subject and by activity and calculates the mean average of the values in the other colums based on this grouping
- Returns this tidy data set
This is an auxiliary function. This function takes a set of data for a specified data set type (i.e "test" or "train") and creates a tidy data set combining the subject, activity (named) and data from the separate files.
This function takes the created tidy test and train data sets and merges them into one tidy data set.
This is an auxiliary function. The features file which has been read into a mapping of column indices and feature label is passed as an argument to this function along with the desired column index in order to return the name of that feature column label.
This function creates a sub set of the data set provided as a parameter to the function based on the provided column label names.
This is an auxiliary function. This function appends the text "average_" to the label names for the columns in which an average has been taken while preparing the final tidy data set.