This repository contains my submitted files for the Week 4 Assignment of the Coursera Getting and Cleaning Data Course. It contains the following files:
CodeBook.md- Describes the data and the steps taken to summarize itReadMe.md- This filerun_analysis.R- R script to merge, clean and sumarize the datatinydata.txt- The final output file generated by therun_analysis.Rscript
PLEASE NOTE. The working directory must be changed in order to run this script on your own computer! This script will not look down the directory structure the way it is unzipped from the original zip file. You need to copy the following files into the current working directory
The data are in two folders, train and test. The files are saved as X_train, X_test, y_train, y_test, subject_train and subject_test. The read.table script is used to read the data from these files into R.
THe rbind() function is used to merge the relating data sets together by rows.
subject_total <- rbind(subject_train.txt + subject_test.txt)
activity_total <- rbind(X_train.txt + X_test.txt)
features_total <- rbind(Y_train.txt + Y_test.txt)
The feature.txt file containing the function names.
The run_analysis.R script completes the following actions:
- Loads the data files into separate objects for manipulation
- Merges the training and test data sets into one data set
- Fixes the table variable names into something meaningful and combine the dataset into one table.
- Filters the dataset.
- Creates a
tidydata.txtfile with the averages for the values grouped by the subject and the activity.