Coder Social home page Coder Social logo

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

Getting-and-Cleaning-Data-Project

This file was created as part of the Getting and Cleaning Data course on Coursera in August 2017.

This repo contains several files:

  1. run_analysis.R is the script which performs the function of this project.
  2. data.zip contains the data necessary for this project (though this can also be downloaded by the R script).
  3. output.txt is the result of running this program.
  4. CodeBook.md describes the data, transformations, and final variables in this project.

run_analysis.R functionality

This section describes how the script performs the following steps:

1. Merges the training and the test sets to create one data set.
Downloads the file from the internet if "data.zip" does not exist in the current working directory and unzips the file. Reads and combines the data, subjects, and activity files for the "test" group and then the "training" group. Combines the test and training datasets by rows.

2. Extracts only the measurements on the mean and standard deviation for each measurement. Reads the variable names in from the "features.txt" file. Applies vthe names "activity" and "subject" to the first two columns, then applies the feature names to the remaining columns of observed variables. Extracts the "activity" column, "subject" column, and every column whose name contains "mean()" or "std()" using grepl.

3. Uses descriptive activity names to name the activities in the data set. Reads the list of activities from activity_labels.txt. Uses a for loop to create a character vector of activity names corresponding to the values in the activity column of the main dataset. Replaces the numeric values of avtivity with the descriptive character values.

4. Appropriately labels the data set with descriptive variable names. Converts every column name to only lowercase letters and removes the punctuation marks.

5. From the data set in step 4, creates a second, independent tidy data set with the average of each variable for each activity and each subject. Loads the dplyr library and creates a new dataframe called "averages." Groups the main dataset by activity and subject, then finds the mean of each combination. Writes the output to a table.

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

Contributors

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