Git Product home page Git Product logo

getting_and_cleaning_data_assignment's Introduction

Assignment Discription

Create one R script called run_analysis.R that does the following:

  1. Merges the training and the test sets to create one data set.
  2. Extracts only the measurements on the mean and standard deviation for each measurement.
  3. Uses descriptive activity names to name the activities in the data set.
  4. Appropriately labels the data set with descriptive activity names.
  5. Creates a second, independent tidy data set with the average of each variable for each activity and each subject.

Steps

  1. use function read.table() to read data into data set and then use function rbind() to put it together in the format of: subjects, labels, everything else;
  2. use function read.table() read the features and retain features of mean and standard deviation; select only the means and standard deviations from data and increment by 2 because data has subjects and labels in the beginning;
  3. read the labels (activities) and replace labels in data with label names;
  4. make a list of the current column names and feature names, then tidy that list by removing every non-alphabetic character and converting to lowercase, then use the list as column names for data;
  5. use function aggregate() to find the mean for each combination of subject and label;
  6. run source("run_analysis.R") , then it will generate a new file tinydata.txt in your working directory.

How the scripts work

  1. download the zip files from https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip
  2. unzip the file to the R working directory
  3. save run_analysis.R to the R working directory
  4. run source("run_analysis.R") , then it will generate a new file tinydata.txt in your working directory.

getting_and_cleaning_data_assignment's People

Contributors

fiona-j avatar

Watchers

James Cloos avatar  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.