Giter VIP home page Giter VIP logo

getting-and-cleaning-data-course-project's Introduction

Getting and Cleaning Data: Course Project

Introduction

This repository contains the course project for the Coursera course Getting and Cleaning data course, part of the Data Science Specialization.

The purpose of this project is to demonstrate the ability to collect, work with, and clean a data set. The goal is to prepare a tidy data set that can be used for later analysis.

The project requires the following output:

  1. A tidy data set as described below

  2. This Github repository with the run_analysis.R script for performing the analysis

  3. A code book that describes the variables, the data, and any transformations or work that you performed to clean up the data called CodeBook.md.

  4. This README.md file

Project

One of the most exciting areas in all of data science right now is wearable computing - see for example this article: http://tinyurl.com/dsatatbftwtsb. Companies like Fitbit, Nike, and Jawbone Up are racing to develop the most advanced algorithms to attract new users. The data linked to from the course website represent data collected from the accelerometers from the Samsung Galaxy S smartphone.

Source Data

The source data for this project was obtained here:

https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip

A full description of the data is available at the site where the data was obtained: http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones

Project Goal

The goal of the project is to output a tidy data set containing only the average of the mean and the standard deviations of each activity and each subject from both the train and test data included in the zip file referenced above.

How to use

The run_analysis.R script can by sourcing the file from within R Studio.

The script will attempt to read data, download data if needed, and output results to the current working directory so it is recommended that you set it accordingly with setwd() prior to running it. If you already have a copy of the data on your local system, set the working directory to the parent folder of that data, or its zip file.

The run_analysis.R script does the following:

  1. If the folder "UCI HAR Dataset" is not present in your current working directory, it will do the following:

    1. Check to see if the zip file is present
    2. If the zip file is not present, it is downloaded to the current working directory.
    3. Uzip the zip file.
  2. Extracts only the measurements on the mean and standard deviation for each measurement from both the test and train sets.

  3. Uses descriptive activity names to name the activities in the data set

  4. Appropriately labels the data set with descriptive variable names.

  5. From the data set in step 4, creates a second, independent tidy dataset with the average of each variable for each activity and each subject.

The output file, tidy.txt, can be read back into R Studio with:

  data <- read.table("tidy.txt", header = TRUE)
  View(data)

Sample output:

Loading required package: data.table
Loading required package: reshape2
Did not find 'UCI HAR Dataset' directory
Downloading 'UCI HAR Dataset.zip' from https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip...
Unzipping file...
Processing test data...
Processing train data...
Pivoting data...
Creating tidy data set...
Writing tidy data set to 'tidy.txt'...

See CodeBook.md for more detail on the output.

References

getting-and-cleaning-data-course-project's People

Contributors

fixel 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.