Skip to content

jjurach/GetCleanDataProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Files

  • codebook.txt
  • run_analysis.R

codebook.md

codebook.md contains the code book for the dataset the analysis will produce.

run_analysis.R

run_analysis.R processes the information in the specified dataset directory, and produces a tidy dataset. This script defines a function called run_analysis() which is called at the bottom to produce the har.data variable.

Each of the files described in the dataset README.txt which were used for this project were read using read.table(). Most files had only one column of interest, so in the analysis script, these were subsetted into a vector immediately after read.table().

run_analysis() performs the following steps:

  1. Load activity_labels.txt as activity_labels
  2. Load features.txt as features
  3. Determine the subset of features we wish to keep as keep_features
  4. For "train" and "test" cases:
    1. Load test/X_*.txt using features for column names
    2. Drop the columns we decide not to keep
    3. Prepend the following columns to the dataset:
      1. 'subject' from subject_*.txt
      2. 'activity' from y_*.txt, mapped through activity_labels
      3. 'case' to reflect "train" or "test".
  5. rbind() both cases into a single data frame
  6. melt() the data.frame to "long form".
  7. dcast long form back into wide form, applying mean on every observation value.

About

Getting and Cleaning Data Coursera Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages