Coder Social home page Coder Social logo

getting-and-cleaning-data's Introduction

Getting and Cleaning Data course project

In the "data" folder there is all the data needed to run the script run_analysis.R. The data is exactly the same as was provided in the .zip file.

##How run_analysis.R script works

  • checks if there is dplyr package installed and installs it if it's not the case.
  • loads all data the files into data frames
  • merges test and train data, putting test data first
  • names variables according to how they are defined in data/activity_labels.txt
  • removes columns with duplicated names (as otherwise we'll have problems with dplyr later, and we don't need these columns anyway)
  • chooses only columns with names that have "mean" and "std", case insensitive
  • adds data about which subject corresponds to each row and which activity type (presented as string)
  • makes subject and activity columns the first in the data frame
  • saves the data to "dirty.txt"
  • generates and saves (to "tidy.txt") a tidy dataset where for each pair (subject, activity) the mean of each variable (names are in data/activity_labels.txt) is calculated.

To explain the last point. Let's say we have following piced of data:

subject activity var1
1 ACTIVITY1 VAR1_VALUE1
1 ACTIVITY1 VAR1_VALUE2
1 ACTIVITY2 VAR_VALUE3

Then in the file "dirty.txt" data will be saved as it is. In the file "tidy.txt" following data will be saved:

subject activity var1
1 ACTIVITY1 mean(c(VAR1_VALUE1, VAR1_VALUE2))
1 ACTIVITY2 VAR_VALUE3

That is, since the pair subject="1" and activity="ACTIVITY1" was present twice, the mean of corresponding var1 values was taken

There is some more info in CodeBook.md

getting-and-cleaning-data's People

Contributors

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