Giter Site home page Giter Site logo

cleaning-data-for-r's Introduction

Cleaning-Data-for-R

An R script is included to get a tidy file ready for statistical analysis.

The script run_analysis.R prepares a dataset for a simple statistical analysis. There are four sections in the script, which I describe next.

[1] Selecting the features

The first step is selecting the 66 out of 561 features that will be included in the dafarame df for analysis. I accomplish that by reading the file features.txt and using the command strsplit to subsequently find those features whose names include "mean()" or "std()."

[2] Processing the test and training sets

The next step is reading the files "test/y_test.txt," "test/subject_test.txt," and "test/X_test.txt." Then, by using the indexes obtained in the previous section, a data frame is built by subsetting the original dataset. The same steps are performed with the corresponding training data files.

[3] Assembling the data frame for analysis

Once all the data files are processed into data frames df1 and df2, one data frame df is created by row binding df1 and df2. Also, a text file is written on disk with the data from df.

[4] Extracting data by groups to perform simple statistical analysis

Finally, the mean and the standard deviation is computed on the records of the data frame df after groupping the records by activity and subject. A text file is written on disk containing the result of this analysis.

cleaning-data-for-r's People

Contributors

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