GithubHelp home page GithubHelp logo

gcd004's Introduction

README.md

Project Instructions

You should 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 variable names.
  5. Creates a second, independent tidy data set with the average of each variable for each activity and each subject.

run_analysis.R

These are the high level steps involved in completing the requirements outlined above. For additional details, please refer to the code.

Part 1 - Cleaning the Data

  1. Concatenate the test and training sets (rbind).
  2. Extract only those features (columns/variables) we are interested in (means and standard deviations).
  3. Add columns for the activity code and subject code (cbind, rbind).
  4. Convert the activity code to a human readable label (factor).
  5. Update the column headers.
  6. Write the data to a file.

Part 2 - Calculating means()

  1. Looping over the number of subject and the activities:
  2. Extract the subset of data for each subject-activity pair.
  3. Calculate the column means and add the results to a data data frame.
  4. Add the subject and activity columns.
  5. Add the column headers.
  6. Write to a file.

Notes

mean() and std() Columns

Only those features whose feature names end in "mean()" or "std()" we included in the analysis. There are other features which also represent variations on mean or standard deviation calculations, but these were left out for this exercise. If these features are of interest, it is sufficient to add their column position to the "features" vector in run_analysis.R.

Variable (Column/Feature) Names

Column headers were added to the data set to make clear what the measurements in each column represent. The column headers were taken directly from the features.txt file. More descriptive names may have been appropriate but would require some degree of interpretation. I have adopted the position that such interpretation should be left to a domain expert. The labels from the features.txt file will be meaningful to any domain expert familiar with the data set.

Reading the Tidy Data

Both tidy data sets are CSV files with a row of column headers. The data sets can be read into R as follows:

my.data <- read.csv("/path/to/file", header=TRUE)

gcd004's People

Contributors

dmark avatar jhds avatar

Watchers

 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.