Skip to content

About

Final project for Getting and cleaning data Coursera course

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

Introduction

This Project is about running analysis on different human activities during thier usage of Galaxy S4 mobile phone. Project contains one script file for the sake of simplicity and understanding the actual code. Besides that it includes codebook.txt file which includes all the variables of tidyData set generated by run_analysis.R.

Algorithm design

Algorithm in this file is written in one file run_Analysis.R. To work properly user should set working directory with sample data. Working directory should include data, train directories and activities_label.txt as well as features.txt. If working directory does not include these files and directory program will through error and it will not produce the desired output. Before starting script will load dplyr package and set working direcotry variable as it will be used to load data, train and features files for analysis. After this algorith is further divided into 12 different steps. Before starting each step you will find comments which will further explain the working of code. These different steps are:

  1. Read train data into tables.
  2. Combine trainData into columns as first column, subject train, second column.
  3. Read test data into tables.
  4. Combine testData into columns as first column, subject test, second column.
  5. read features.txt from file, make put it as column names of new data set.
  6. get mean and std columns. 7 read activities.
  7. Link activity with labels.
  8. Remove extra columns produced by merging.
  9. Give descriptive names to each column, each row contains 3 column names in lower camel case.
  10. average it one subject and label.
  11. export data set

Detailed Information about Steps

In first step program will load train data in subject_train, x_train and y_train. In second step data of first step will be joined in columns to get all trained data. Output of this step is trainData. In 3rd step test data will be loaded into subject_test, x_test and y_test. In fourth step 3rd step data will be joined in different columns to product testData variable. trainData and testData will be joined at the end of fourth step as finalData. In 5th step features will be loaded into features variable which will be concatenated with two new rows for subject and labels. In the end second column of this is loaded as finalData column set. In sixth step mean and std columns are retained whereas other columns are removed. In seventh step activities are read into acitvities_label variable. In eigth step activities_label is merged with finalData. This will produce inner join and we have now labels for activites. In ninth step extra columns from finalData is removed to retain just need variables into final data. In 10th step meaningful names are assigned to column names of finalData. In elevnth step mean is calculated for each observation of each activities. In 12th step a tab separated final output file is created in the working directory.

It also includes codebook.txt, which explains columns used in output.txt.

Contact

please contact me if you have problem: sakram80@gmail.com

About

Final project for Getting and cleaning data Coursera course

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages