Skip to content

fusionprogguy/coursera-wearabledata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

title author date output
README.md
fusionprogguy
Sunday, June 21, 2015
html_document

README

Project: Human Activity Recognition Using Smartphones Data

The project for the course Getting and Cleaning Data was to read in the Human Activity Recognition Using Smartphones Data Set and write a program run_analysis.R to perform a transformation of the multiple data sets and output a tidy data set tidy_activity_mean.txt

You can read more about the data and the analysis in the markdown file codebook.md.

Installation

  1. Download the data from the following link https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip

  2. Unzip the file Dataset.zip file

  3. Place the run_analysis.R file into the folder:

     ```
     \getdata-projectfiles-UCI HAR Dataset\UCI HAR Dataset
     ```
    

You should see folders: 'test', 'train' and Text files: README.txt, activity_labels.txt, features.txt, features_info.txt and R scripts: run_analysis.R

  1. Open RStudio and set your working directory to the folder in which the data was downloaded above in the subdirectory \UCI HAR Dataset Your setwd command should look something like this on a Winows operating system. Change the folder slashes if you are on a Mac or Linux:

     ```
     setwd("F:/Courses/Coursera/Getting and Cleaning Data/Week 3/getdata-projectfiles-UCI HAR Dataset/UCI HAR Dataset")
     ```
    
  2. Run the run_analysis.R script by using the source command as follows:

     ```
     source("run_analysis.R")
     ```
    
  3. Wait for the program to load libraries and files. Two libraries and their dependencies will be loaded automatically, if they have not been installed on your system. The first package is the reshape2 package and the dplyr package. Processing all files can take up to 30 seconds depending on the speed of your computer. Messages are printed in red as files are loaded or writen to file.

  4. Check to see if there were any warning messages about missing files or packages. Troubleshoot if necessary.

  5. Once the script has finished you should see a new tidy data file in the folder: tidy_activity_mean.txt

Reading Tidy Data

If you are simply interested in reading the tidy_activity_mean.txt without having to run run_analysis.R you can load the file with the following command in RStudio:

read.table("tidy_activity_mean.txt", header = TRUE)

##Code outline for script run_analysis.R

The following outline shows the steps that the script takes.

*(0) CHECK FOLDER AND LOAD LIBRARIES

*(1) LOAD FILES

*(2) DESCRIPTIVE COLUMNS LABELS

*(3) SELECT MEAN AND STD COLUMNS Extracts only the measurements on the mean and standard deviation for each measurement

*(4) MERGE FILES Merges the UCI HAR training and test data sets to create one large data set

*(5) DESCRIPTIVE ACTIVITY NAMES Uses descriptive activity names to name the activities in the data set

*(6) CALCULATE THE MEAN FOR EACH ACTIVITY AND SUBJECT

*(7) DESCRIPTIVE VARIABLE NAMES Appropriately labels the data set with descriptive variable names

*(8) GENERATE TIDY OUTPUT FILE Creates a second, independent tidy data set with the average of each variable for each activity and each subject

###Excluded data The script run_analysis.R did not process any data from the raw test signal data in the following folder:

UCI HAR Dataset\test\Inertial Signals 

Thus the data files in the "Inertial Signals" folders were ignored.

Credits

Hadley Wickham's Tidy Data paper

Zeno Rocha's template for Github READMEs (Markdown) + Sublime Snippet https://gist.github.com/zenorocha/4526327

License

Use of this dataset in publications must be acknowledged by referencing the following publication [1]

[1] Davide Anguita, Alessandro Ghio, Luca Oneto, Xavier Parra and Jorge L. Reyes-Ortiz. A Public Domain Dataset for Human Activity Recognition Using Smartphones. 21th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, ESANN 2013. Bruges, Belgium 24-26 April 2013.

This dataset is distributed AS-IS and no responsibility implied or explicit can be addressed to the authors or their institutions for its use or misuse. Any commercial use is prohibited.

##Contact

e-mail: [email protected] Twitter: @StevenMuschalik

About

Human Activity Recognition Using Smartphones Data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages