Giter VIP home page Giter VIP logo

gacd-project's Introduction

Getting and Cleaning Data: Course Project

Jeff Jetton


The R code contained in run_analysis.R was written to read and process a set of data tables found at the UC Irvine Data Repository. This data was collected from the embedded accelerometer and gyroscope of Samsung Galaxy S II phones worn by 30 different volunteers as they repeatedly performed activities of six types: Standing, sitting, lying down (recorded in the data as "laying"), and walking on level ground as well as up and down stairs.


What the R Script Does

While the data, as originally presented, divided the subjects into training and test sets, the R script combines the data back together into a single data set (step 1). It only extracts the features that are direct means or standard deviations of the experimental measurements (step 2).

Note that some features with the word "mean" in them were not extracted, under the rationale that they are not actually direct means of measurements. For example, the angle features at the end of the feature set are derived from means, but are not themselves a "mean" of anything. Likewise, the "meanFreq" features are actually weighted averages of just the frequency components.

Next, the script converts the activities, which were coded as integers in the source data, into more descriptive, full-text descriptions (step 3). This is treated as a six-level factor variable in the data frame.

In the source data, the feature names were stored in a separate file rather than as headers in each main data file. We next transform the approriate feature names, removing invalid characters, etc., and apply them to the columns in our data frame (step 4).

Finally, our data is aggregated at the subject/activity level and output as a space-separated, plain text file named tidymeans.txt (step 5). There are six different activity rows for each of the 30 subjects, for a total of 180 rows. The remaining columns are the means of the selected features from the source data. (Note that this effectively gives us "means of means" and "means of standard deviations".)

Please refer to the included codebook for more information on the included fields and the subsequent output file.


Assumptions on Directory Structure

The R script assumes that the source data is contained in the current working directory, maintaining the same directory structure it is originally provided in when downloaded from the UCI website:

  • [Current Working Directory]
    • [UCI HAR Dataset]
      • [test]
        • subject_test.txt
        • X_test.txt
        • y_text.txt
      • [train]
        • subject_train.txt
        • X_train.txt
        • y_train.txt
      • activity_labels.txt
      • features.txt

gacd-project's People

Contributors

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