forked from rdpeng/RepData_PeerAssessment1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,147 @@ | ||
RepData_PeerAssessment1 | ||
======================= | ||
## Introduction | ||
|
||
Peer Assessment 1 for Reproducible Research | ||
It is now possible to collect a large amount of data about personal | ||
movement using activity monitoring devices such as a | ||
[Fitbit](http://www.fitbit.com), [Nike | ||
Fuelband](http://www.nike.com/us/en_us/c/nikeplus-fuelband), or | ||
[Jawbone Up](https://jawbone.com/up). These type of devices are part of | ||
the "quantified self" movement -- a group of enthusiasts who take | ||
measurements about themselves regularly to improve their health, to | ||
find patterns in their behavior, or because they are tech geeks. But | ||
these data remain under-utilized both because the raw data are hard to | ||
obtain and there is a lack of statistical methods and software for | ||
processing and interpreting the data. | ||
|
||
This assignment makes use of data from a personal activity monitoring | ||
device. This device collects data at 5 minute intervals through out the | ||
day. The data consists of two months of data from an anonymous | ||
individual collected during the months of October and November, 2012 | ||
and include the number of steps taken in 5 minute intervals each day. | ||
|
||
## Data | ||
|
||
The data for this assignment can be downloaded from the course web | ||
site: | ||
|
||
* Dataset: [Activity monitoring data](https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2Factivity.zip) [52K] | ||
|
||
The variables included in this dataset are: | ||
|
||
* **steps**: Number of steps taking in a 5-minute interval (missing | ||
values are coded as `NA`) | ||
|
||
* **date**: The date on which the measurement was taken in YYYY-MM-DD | ||
format | ||
|
||
* **interval**: Identifier for the 5-minute interval in which | ||
measurement was taken | ||
|
||
|
||
|
||
|
||
The dataset is stored in a comma-separated-value (CSV) file and there | ||
are a total of 17,568 observations in this | ||
dataset. | ||
|
||
|
||
## Assignment | ||
|
||
This assignment will be described in multiple parts. You will need to | ||
write a report that answers the questions detailed below. Ultimately, | ||
you will need to complete the entire assignment in a **single R | ||
markdown** document that can be processed by **knitr** and be | ||
transformed into an HTML file. | ||
|
||
Throughout your report make sure you always include the code that you | ||
used to generate the output you present. When writing code chunks in | ||
the R markdown document, always use `echo = TRUE` so that someone else | ||
will be able to read the code. **This assignment will be evaluated via | ||
peer assessment so it is essential that your peer evaluators be able | ||
to review the code for your analysis**. | ||
|
||
For the plotting aspects of this assignment, feel free to use any | ||
plotting system in R (i.e., base, lattice, ggplot2) | ||
|
||
Fork/clone the [GitHub repository created for this | ||
assignment](http://github.com/rdpeng/RepData_PeerAssessment1). You | ||
will submit this assignment by pushing your completed files into your | ||
forked repository on GitHub. The assignment submission will consist of | ||
the URL to your GitHub repository. | ||
|
||
NOTE: The GitHub repository also contains the dataset for the | ||
assignment so you do not have to download the data separately. | ||
|
||
|
||
|
||
### Loading and preprocessing the data | ||
|
||
Show any code that is needed to | ||
|
||
1. Load the data (i.e. `read.csv()`) | ||
|
||
2. Process/transform the data (if necessary) into a format suitable for your analysis | ||
|
||
|
||
### What is mean total number of steps taken per day? | ||
|
||
For this part of the assignment, you can ignore the missing values in | ||
the dataset. | ||
|
||
1. Make a histogram of the total number of steps taken each day | ||
|
||
2. Calculate and report the **mean** and **median** total number of steps taken per day | ||
|
||
|
||
### What is the average daily activity pattern? | ||
|
||
1. Make a time series plot (i.e. `type = "l"`) of the 5-minute interval (x-axis) and the average number of steps taken, averaged across all days (y-axis) | ||
|
||
2. Which 5-minute interval, on average across all the days in the dataset, contains the maximum number of steps? | ||
|
||
|
||
### Imputing missing values | ||
|
||
Note that there are a number of days/intervals where there are missing | ||
values (coded as `NA`). The presence of missing days may introduce | ||
bias into some calculations or summaries of the data. | ||
|
||
1. Calculate and report the total number of missing values in the dataset (i.e. the total number of rows with `NA`s) | ||
|
||
2. Devise a strategy for filling in all of the missing values in the dataset. The strategy does not need to be sophisticated. For example, you could use the mean/median for that day, or the mean for that 5-minute interval, etc. | ||
|
||
3. Create a new dataset that is equal to the original dataset but with the missing data filled in. | ||
|
||
4. Make a histogram of the total number of steps taken each day and Calculate and report the **mean** and **median** total number of steps taken per day. Do these values differ from the estimates from the first part of the assignment? What is the impact of imputing missing data on the estimates of the total daily number of steps? | ||
|
||
|
||
### Are there differences in activity patterns between weekdays and weekends? | ||
|
||
For this part the `weekdays()` function may be of some help here. Use | ||
the dataset with the filled-in missing values for this part. | ||
|
||
1. Create a new factor variable in the dataset with two levels -- "weekday" and "weekend" indicating whether a given date is a weekday or weekend day. | ||
|
||
1. Make a panel plot containing a time series plot (i.e. `type = "l"`) of the 5-minute interval (x-axis) and the average number of steps taken, averaged across all weekday days or weekend days (y-axis). The plot should look something like the following, which was creating using **simulated data**: | ||
|
||
![plot of chunk sample_panelplot](instructions_fig/sample_panelplot.png) | ||
|
||
|
||
**Your plot will look different from the one above** because you will | ||
be using the activity monitor data. Note that the above plot was made | ||
using the lattice system but you can make the same version of the plot | ||
using any plotting system you choose. | ||
|
||
|
||
## Submitting the Assignment | ||
|
||
To submit the assignment: | ||
|
||
1. Commit the your completed `PA1_template.Rmd` file to the `master` branch of your git repository (you should already be on the `master` branch unless you created new ones) | ||
|
||
2. Commit your `PA1_template.md` and `PA1_template.html` files produced by processing your R markdown file with `knit2html()` function in R (from the **knitr** package) | ||
|
||
3. If your document has figures included (it should) then they should have been placed in the `figures/` directory by default (unless you overrided the default). Add and commit the `figures/` directory to yoru git repository. | ||
|
||
4. Push your `master` branch to GitHub. | ||
|
||
5. Submit the URL to your GitHub repository for this assignment on the course web site. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.