Skip to content

Latest commit

 

History

History
executable file
·
156 lines (144 loc) · 7.91 KB

Codebook.md

File metadata and controls

executable file
·
156 lines (144 loc) · 7.91 KB
title author date output
Codebook for Coursera Getting and Cleaning Data Course Project
mjpalacios
October 21, 2015
html_document

This document describes the variables in the tidy dataset generated by the analysis function in this repository.

##References

  1. "features_info.txt"" included with the original dataset
  2. README.md in this repository

Transformations applied to input data using run_analysis()

The following actions are peformed to create the tidy dataset:

  1. Build training dataset
    • Read subject id data from "subject_train.txt"
    • Read feature data from "X_train.txt" and replace with headers from #1
    • Read activity id and label data from "y_train.txt"
    • Juxtapose subject, feature, and activity data together
  2. Build test dataset
    • Repeat the same steps for test dataset.
  3. Merge training and test datasets
  4. Process names of variables
    • Read names of variables from "features.txt"
    • Format names according to requirements
      • Remove characters "(" ,")" and "-"
      • Convert names to lower case
      • Additionally, remove duplicate name parts (e.g. fBodyBodyAccJerkMag-mean() becomes fbodyaccjerkmagmean)
  5. Extract required variables
    • Read in activity names from "activity_labels.txt"
    • Merge activity names with the combined dataset from #4
    • Extract only the mean and standard deviation measurements for each subject and activity.
      • NOTE: Referring to "features_info.txt", only the following variables are considered as mean and standard deviation measurements
        • mean()
        • std()
  6. Tidy dataset is derived from #5 by performing the following
    • Data are grouped by subject and activity.
    • Data are aggregated using mean() as the aggregate function
  7. Save tidy dataset to a text file named "run_analysis.txt""

Dictionary

The below tables describe the variables in the tidy dataset.
Table 1 shows an example on how to intepret a data variable names.
Table 2 describes the full list of variables in the tidy dataset.

Table 1: Interpreting variable names

Example: tbodyaccmeanx

Label Interpretation
tbodyacc This means body acceleration signal value in time domain.
         | The first character denotes the domain of the value
         |   * Possible values:
         |       - 't' - denotes time domain signal
         |       - 'f' - denotes frequency domain signals
         | The remain characters describes the type of feature the value represent
         |   * Possible values: 
         |       - bodyacc: body acceleration signal
         |       - gravityacc: gravity acceleration signal
         |       - bodyaccjerk: body acceleration signal
         |       - bodygyrojerk: body gyroscope jerk
         |       - bodyaccmag: body acceleration jerk
         |       - gravityaccmag: gravity acceleration magnitude
         |       - bodyaccjerkmag: body acceleration jerk magnitude
         |       - bodygyromag: body gyroscope magnitude
         |       - bodygyrojerkmag: body gyroscope jerk magnitude

mean | This refers to the measure type of the value | * Possible values: | - mean: arithmetic mean | - std: standard deviation x | This represents the 3-axial direction of the value, when present. | This label is missing in variables representing magnitudes | * Possible values: | - x: x-direction | - y: y-direction | - z: z-direction

Table 2: Variables in tidy dataset

Variable Type Description
subject numeric Tag identifying participants whose data was recorded in the dataset
                      |              | Valid values: 1 to 30

activity | character | Activity performed by subject | | Valid values: WALKING, WALKING_UPSTAIRS, WALKING_DOWNSTAIRS, SITTING, STANDING, LAYING tbodyaccmeanx | numeric | See Table 1 tbodyaccmeany | numeric | See Table 1 tbodyaccmeanz | numeric | See Table 1 tbodyaccstdx | numeric | See Table 1 tbodyaccstdy | numeric | See Table 1 tbodyaccstdz | numeric | See Table 1 tgravityaccmeanx | numeric | See Table 1 tgravityaccmeany | numeric | See Table 1 tgravityaccmeanz | numeric | See Table 1 tgravityaccstdx | numeric | See Table 1 tgravityaccstdy | numeric | See Table 1 tgravityaccstdz | numeric | See Table 1 tbodyaccjerkmeanx | numeric | See Table 1 tbodyaccjerkmeany | numeric | See Table 1 tbodyaccjerkmeanz | numeric | See Table 1 tbodyaccjerkstdx | numeric | See Table 1 tbodyaccjerkstdy | numeric | See Table 1 tbodyaccjerkstdz | numeric | See Table 1 tbodygyromeanx | numeric | See Table 1 tbodygyromeany | numeric | See Table 1 tbodygyromeanz | numeric | See Table 1 tbodygyrostdx | numeric | See Table 1 tbodygyrostdy | numeric | See Table 1 tbodygyrostdz | numeric | See Table 1 tbodygyrojerkmeanx | numeric | See Table 1 tbodygyrojerkmeany | numeric | See Table 1 tbodygyrojerkmeanz | numeric | See Table 1 tbodygyrojerkstdx | numeric | See Table 1 tbodygyrojerkstdy | numeric | See Table 1 tbodygyrojerkstdz | numeric | See Table 1 tbodyaccmagmean | numeric | See Table 1 tbodyaccmagstd | numeric | See Table 1 tgravityaccmagmean | numeric | See Table 1 tgravityaccmagstd | numeric | See Table 1 tbodyaccjerkmagmean | numeric | See Table 1 tbodyaccjerkmagstd | numeric | See Table 1 tbodygyromagmean | numeric | See Table 1 tbodygyromagstd | numeric | See Table 1 tbodygyrojerkmagmean | numeric | See Table 1 tbodygyrojerkmagstd | numeric | See Table 1 fbodyaccmeanx | numeric | See Table 1 fbodyaccmeany | numeric | See Table 1 fbodyaccmeanz | numeric | See Table 1 fbodyaccstdx | numeric | See Table 1 fbodyaccstdy | numeric | See Table 1 fbodyaccstdz | numeric | See Table 1 fbodyaccjerkmeanx | numeric | See Table 1 fbodyaccjerkmeany | numeric | See Table 1 fbodyaccjerkmeanz | numeric | See Table 1 fbodyaccjerkstdx | numeric | See Table 1 fbodyaccjerkstdy | numeric | See Table 1 fbodyaccjerkstdz | numeric | See Table 1 fbodygyromeanx | numeric | See Table 1 fbodygyromeany | numeric | See Table 1 fbodygyromeanz | numeric | See Table 1 fbodygyrostdx | numeric | See Table 1 fbodygyrostdy | numeric | See Table 1 fbodygyrostdz | numeric | See Table 1 fbodyaccmagmean | numeric | See Table 1 fbodyaccmagstd | numeric | See Table 1 fbodyaccjerkmagmean | numeric | See Table 1 fbodyaccjerkmagstd | numeric | See Table 1 fbodygyromagmean | numeric | See Table 1 fbodygyromagstd | numeric | See Table 1 fbodygyrojerkmagmean | numeric | See Table 1 fbodygyrojerkmagstd | numeric | See Table 1