Skip to content

shabss/getdata.proj1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Intent

run_analysis.R produces a tidy data set that contains averages of means and standard deviation measurements of Human Activity Recognition Using Smartphones Dataset Version 1.0 (http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones) downloaded from https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip

##Instructions Download the zip file above and extract it. Copy run_analysis.R to that folder and source it from R (after chaging working directory to unzipped file folder). tidy.txt will be produced after sourcing is complete

Methodology

The tidy data set is produced with the following steps:

  • Convert feature names (in features.txt) to descriptive names as follows (see name mappings below):
    • Convert to lower case
    • Characters '(', ')', '-' and ',' were converted to dot '.'
    • Wrap terms of mean, std, body, gyro, acc, jerk, mag, min, max, sma, mean and gravity within dots "." e.g "word"" --> ".word."
    • Remove consequtive and trailing dots
    • "bandEnergy" variales actually represent ranges, therefore change "X-Y" to "XtoY"
    • Rename duplicated "bandEnergy" variables to contain X,Y,Z coordinates
  • Produce a merged data set
    • Merge the training and the test sets while adding respecitve subjects for each row and using activity names instead of codes (loaded from activity_labels.txt)
  • From the merged data set, extract columns that contain the mean and standard deviation for each measurement (see name mappings below)
    • Columns are selected by grep-ing "mean" and "std" from the feature names
  • Produce the tidy data set with the average of each feature for each activity and each subject

Feature name mapping

Please look at the feature_info.txt in the downloaded zip file for information on raw names. As indicated above, the raw names were converted into descriptive names. Following table contains the conversion info.

Seq Raw Name Descriptive Name
1 <from subject_XXX.txt>subject
2 <from activity_label.txt>activity
3 tBodyAcc-mean()-X t.body.acc.mean.x
4 tBodyAcc-mean()-Y t.body.acc.mean.y
5 tBodyAcc-mean()-Z t.body.acc.mean.z
6 tBodyAcc-std()-X t.body.acc.std.x
7 tBodyAcc-std()-Y t.body.acc.std.y
8 tBodyAcc-std()-Z t.body.acc.std.z
9 tGravityAcc-mean()-X t.gravity.acc.mean.x
10 tGravityAcc-mean()-Y t.gravity.acc.mean.y
11 tGravityAcc-mean()-Z t.gravity.acc.mean.z
12 tGravityAcc-std()-X t.gravity.acc.std.x
13 tGravityAcc-std()-Y t.gravity.acc.std.y
14 tGravityAcc-std()-Z t.gravity.acc.std.z
15 tBodyAccJerk-mean()-X t.body.acc.jerk.mean.x
16 tBodyAccJerk-mean()-Y t.body.acc.jerk.mean.y
17 tBodyAccJerk-mean()-Z t.body.acc.jerk.mean.z
18 tBodyAccJerk-std()-X t.body.acc.jerk.std.x
19 tBodyAccJerk-std()-Y t.body.acc.jerk.std.y
20 tBodyAccJerk-std()-Z t.body.acc.jerk.std.z
21 tBodyGyro-mean()-X t.body.gyro.mean.x
22 tBodyGyro-mean()-Y t.body.gyro.mean.y
23 tBodyGyro-mean()-Z t.body.gyro.mean.z
24 tBodyGyro-std()-X t.body.gyro.std.x
25 tBodyGyro-std()-Y t.body.gyro.std.y
26 tBodyGyro-std()-Z t.body.gyro.std.z
27 tBodyGyroJerk-mean()-X t.body.gyro.jerk.mean.x
28 tBodyGyroJerk-mean()-Y t.body.gyro.jerk.mean.y
29 tBodyGyroJerk-mean()-Z t.body.gyro.jerk.mean.z
30 tBodyGyroJerk-std()-X t.body.gyro.jerk.std.x
31 tBodyGyroJerk-std()-Y t.body.gyro.jerk.std.y
32 tBodyGyroJerk-std()-Z t.body.gyro.jerk.std.z
33 tBodyAccMag-mean() t.body.acc.mag.mean
34 tBodyAccMag-std() t.body.acc.mag.std
35 tGravityAccMag-mean() t.gravity.acc.mag.mean
36 tGravityAccMag-std() t.gravity.acc.mag.std
37 tBodyAccJerkMag-mean() t.body.acc.jerk.mag.mean
38 tBodyAccJerkMag-std() t.body.acc.jerk.mag.std
39 tBodyGyroMag-mean() t.body.gyro.mag.mean
40 tBodyGyroMag-std() t.body.gyro.mag.std
41 tBodyGyroJerkMag-mean() t.body.gyro.jerk.mag.mean
42 tBodyGyroJerkMag-std() t.body.gyro.jerk.mag.std
43 fBodyAcc-mean()-X f.body.acc.mean.x
44 fBodyAcc-mean()-Y f.body.acc.mean.y
45 fBodyAcc-mean()-Z f.body.acc.mean.z
46 fBodyAcc-std()-X f.body.acc.std.x
47 fBodyAcc-std()-Y f.body.acc.std.y
48 fBodyAcc-std()-Z f.body.acc.std.z
49 fBodyAcc-meanFreq()-X f.body.acc.mean.freq.x
50 fBodyAcc-meanFreq()-Y f.body.acc.mean.freq.y
51 fBodyAcc-meanFreq()-Z f.body.acc.mean.freq.z
52 fBodyAccJerk-mean()-X f.body.acc.jerk.mean.x
53 fBodyAccJerk-mean()-Y f.body.acc.jerk.mean.y
54 fBodyAccJerk-mean()-Z f.body.acc.jerk.mean.z
55 fBodyAccJerk-std()-X f.body.acc.jerk.std.x
56 fBodyAccJerk-std()-Y f.body.acc.jerk.std.y
57 fBodyAccJerk-std()-Z f.body.acc.jerk.std.z
58 fBodyAccJerk-meanFreq()-X f.body.acc.jerk.mean.freq.x
59 fBodyAccJerk-meanFreq()-Y f.body.acc.jerk.mean.freq.y
60 fBodyAccJerk-meanFreq()-Z f.body.acc.jerk.mean.freq.z
61 fBodyGyro-mean()-X f.body.gyro.mean.x
62 fBodyGyro-mean()-Y f.body.gyro.mean.y
63 fBodyGyro-mean()-Z f.body.gyro.mean.z
64 fBodyGyro-std()-X f.body.gyro.std.x
65 fBodyGyro-std()-Y f.body.gyro.std.y
66 fBodyGyro-std()-Z f.body.gyro.std.z
67 fBodyGyro-meanFreq()-X f.body.gyro.mean.freq.x
68 fBodyGyro-meanFreq()-Y f.body.gyro.mean.freq.y
69 fBodyGyro-meanFreq()-Z f.body.gyro.mean.freq.z
70 fBodyAccMag-mean() f.body.acc.mag.mean
71 fBodyAccMag-std() f.body.acc.mag.std
72 fBodyAccMag-meanFreq() f.body.acc.mag.mean.freq
73 fBodyBodyAccJerkMag-mean() f.body.body.acc.jerk.mag.mean
74 fBodyBodyAccJerkMag-std() f.body.body.acc.jerk.mag.std
75 fBodyBodyAccJerkMag-meanFreq() f.body.body.acc.jerk.mag.mean.freq
76 fBodyBodyGyroMag-mean() f.body.body.gyro.mag.mean
77 fBodyBodyGyroMag-std() f.body.body.gyro.mag.std
78 fBodyBodyGyroMag-meanFreq() f.body.body.gyro.mag.mean.freq
79 fBodyBodyGyroJerkMag-mean() f.body.body.gyro.jerk.mag.mean
80 fBodyBodyGyroJerkMag-std() f.body.body.gyro.jerk.mag.std
81 fBodyBodyGyroJerkMag-meanFreq() f.body.body.gyro.jerk.mag.mean.freq
82 angle(tBodyAccMean,gravity) angle.t.body.acc.mean.gravity
83 angle(tBodyAccJerkMean),gravityMean) angle.t.body.acc.jerk.mean.gravity.mean
84 angle(tBodyGyroMean,gravityMean) angle.t.body.gyro.mean.gravity.mean
85 angle(tBodyGyroJerkMean,gravityMean) angle.t.body.gyro.jerk.mean.gravity.mean
86 angle(X,gravityMean) angle.x.gravity.mean
87 angle(Y,gravityMean) angle.y.gravity.mean
88 angle(Z,gravityMean) angle.z.gravity.mean

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages