Coder Social home page Coder Social logo

gettingcleaningdata's Introduction

Getting and Cleaning Data Course Project

Summary

The aim of the R script run_analysis.R provided in this repository is to produce:

  1. harDB: a data frame in the R global environment containing a selection of the original measures for all the records included in the Human Activity Recognition Using Smartphones Data Set
  2. harDB_m: a data frame with the averages of the measures contained in the harDB data frame calculated grouping records by subject id and activity type
  3. harDB_m.txt: a text file in the working directory containing the harDB_m data set

Details on the HAR data set and on the process to create the two tidy data sets can be found in the CodeBook.md file.

For additional details, see also comments in the run_analysis.R script.

Running The Script

The script assumes a standard installation of R (tested on R v3.2.0). No additional packages are required.

The script performs the following actions:

  1. If the zip file containing the HAR data set does not exist in the working directory, download it from the URL provided in the details section of the course project.
  2. If the data folder containing the original UCI files does not exist in the working directory, extract all the files from the zip archive. An alternative approach could be to extract only the necessary files using a connection.
  3. As information is separated into several files, it merges all the pieces to create a full tidy data set.
  4. Extracts only the measurements on the mean and standard deviation for each measurement. Here are selected both the mean() and meanFreq() variables. Should a narrower or wider definition be required, you have to adjust the regexp to select the correct variable names.
  5. Activity IDs are recoded as factors and labeled accordingly.
  6. Use original variable names to label the columns of the full data set.
  7. Creates a second data set with the averages of the measures contained in the harDB data frame grouped by subject id and activity type.
  8. Export the harDB_m data frame to the harDB_m.txt file.
  9. Clear all temporary variables.

All the files gathered in this folder provide a solution for the Coursera Getting And Cleaning Data course project.

gettingcleaningdata's People

Contributors

ittegrat avatar

Watchers

 avatar

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.