Source Code: run_analysis.R
Instructions:
- Download run_analysis.R into your working directory.
- From R console or R Studio run the command:
source("run_analysis.R")
Original data source and description: http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones
Data source for project: https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip
Project objectives:
- Merges the training and the test sets to create one data set.
- Extracts only the measurements on the mean and standard deviation for each measurement.
- Uses descriptive activity names to name the activities in the data set
- Appropriately labels the data set with descriptive activity names.
- Creates a second, independent tidy data set with the average of each variable for each activity and each subject.
Reference: https://class.coursera.org/getdata-003/human_grading/view/courses/972136/assessments/3/submissions
Program Output:
- tidydata.csv - Tidy data containing average and standard deviation measurements for each observation.
- avg_data.csv - Mean values of the observations from tidydata.csv, grouped by subject and activity.
Dependencies:
library("stringr")
Program operation:
- Create and change to working directory "gcd"
- Download and extract data
- Read Test dataset
- Read Train dataset.
- Merge datasets
- Label columns
- Replace numeric activity labels with descriptive strings.
- Select data to keep in final dataset (average and standard deviation values)
- Create second dataset with averages grouped by subject and activity.
- Save the datasets to disk.