Giter VIP home page Giter VIP logo

getting-and-cleaning-data's Introduction

Getting & Cleaning Data - Course Project

The script run_analysis.R clean the data. It does the following:

1. Merges the training and the test sets to create one data set.

  • The training and testing dataset are first read into two variables, train and test, respectively
  • The training & testing dataset are then merged using rbind into a single variable named all

Notes:

  • In the first part of the code, I only merged X_train & X_test. y_train and y_test, subject_train, subject_test are merged into all later in part 3 for coding convenience.

2. Extracts only the measurements on the mean and standard deviation for each measurement.

  • First the list of all feature names are read into variable features
  • Then the features with mean and standard deviation are found using regular expression. The column indices are stored in variable good_columns
  • Variable all is subsetted with good_columns

Notes:

  • In here I extracted 66 columns. There are columns "meanFreq" that I purposely excluded. Only columns that has "mean()" and "std()" in its name are included

3. Uses descriptive activity names to name the activities in the data set and 4. Appropriately labels the data set with descriptive activity names.

  • First the English names of the activites are read into variable activity_labels.
  • Then activity_labels are used to labels y_train and y_test, and then merged into all
  • Next, subject are read and merged into subject_all
  • Finally, subject_all is merged into all. After this step, all contains all the information that we need to merge

5. Creates a second, independent tidy data set with the average of each variable for each activity and each subject.

  • The average are calculated using function aggregate. The result is stored in variable tidy which will be then stored into a file named "tidy_data.txt"
  • tidy has 180 rows. This is because: There are 30 subject and 6 activities, thus there are 30*6 = 180 averages for each variable.

getting-and-cleaning-data's People

Contributors

vkrit avatar

Watchers

 avatar James Cloos avatar

Forkers

ramshank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.