Skip to content

Commit 9c7189d

Browse files
committed
rdpeng#3 formating updatte
1 parent ac8588c commit 9c7189d

File tree

38 files changed

+144
-131
lines changed

38 files changed

+144
-131
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"source_window_id": "",
3+
"Source": "Source",
4+
"cursorPosition": "142,0",
5+
"scrollLine": "98"
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
C%3A%2FUsers%2Fcliver%2FDownloads%2FR%2FRepData_PeerAssessment1%2FPA1_template.Rmd="94B389D5"
2+
C%3A%2FUsers%2Fcliver%2FDownloads%2FR%2Fgit%2FRepData_PeerAssessment1-1%2FPA1_template.Rmd="48DD0FE2"
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"id": "1F8CFACD",
3-
"path": "C:/Users/cliver/Downloads/R/RepData_PeerAssessment1/PA1_template.Rmd",
3+
"path": "C:/Users/cliver/Downloads/R/git/RepData_PeerAssessment1-1/PA1_template.Rmd",
44
"project_path": "PA1_template.Rmd",
55
"type": "r_markdown",
6-
"hash": "1732455302",
6+
"hash": "1290283657",
77
"contents": "",
88
"dirty": false,
99
"created": 1612978437426.0,
@@ -12,15 +12,15 @@
1212
"properties": {
1313
"source_window_id": "",
1414
"Source": "Source",
15-
"cursorPosition": "102,0",
16-
"scrollLine": "87"
15+
"cursorPosition": "142,0",
16+
"scrollLine": "98"
1717
},
1818
"folds": "",
19-
"lastKnownWriteTime": 1612980099,
19+
"lastKnownWriteTime": 1612983497,
2020
"encoding": "UTF-8",
2121
"collab_server": "",
2222
"source_window": "",
23-
"last_content_update": 1612980099777,
23+
"last_content_update": 1612983497969,
2424
"read_only": false,
2525
"read_only_alternatives": []
2626
}

.Rproj.user/F3EFA60F/sources/per/t/1F8CFACD-contents renamed to .Rproj.user/F3EFA60F/sources/s-3B72DEC4/1F8CFACD-contents

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,75 @@ output:
66
---
77

88

9-
## Loading and preprocessing the data
9+
## Loading and preprocessing the data
10+
1011
1. Load the data (i.e. read.csv())
1112
```{r}
1213
library(tidyverse)
1314
data1 <- read_csv("activity/activity.csv")
14-
```
15-
2. Process/transform the data (if necessary) into a format suitable for your analysis
15+
```
16+
17+
2. Process/transform the data (if necessary) into a format suitable for your analysis
18+
1619
```{r}
1720
data_na<-na.omit(data1)
1821
```
19-
## What is mean total number of steps taken per day?
22+
## What is mean total number of steps taken per day?
23+
2024

2125
1. Make a histogram of the total number of steps taken each day
2226
```{r}
2327
steps<-aggregate((data_na$steps), by=list(date=data_na$date), sum)
2428
head(steps)
2529
hist(steps$x, main="Histogram of total number of steps per day",
2630
xlab="Total number of steps in a day")
27-
```
31+
```
32+
2833
2. Calculate and report the mean and median total number of steps taken per day
2934
```{r}
3035
mean(steps$x)
3136
median(steps$x)
32-
```
33-
## What is the average daily activity pattern?
37+
```
38+
39+
## What is the average daily activity pattern?
40+
3441

3542
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)
36-
```{r}
43+
```{r}
44+
45+
3746
interval<-aggregate((data_na$steps), by=list(interval=data_na$interval), mean)
3847

3948
p <- ggplot(interval, aes(x=interval, y=x)) +
4049
geom_line() +
4150
xlab("Interval")+
4251
ylab("Average number of steps")
4352
p
44-
```
53+
```
54+
55+
4556
2. Which 5-minute interval, on average across all the days in the dataset, contains the maximum number of steps?
57+
4658
```{r}
4759
interval[interval$x == max(interval=interval$x),]
4860

4961
```
5062

5163

52-
## Imputing missing values
53-
1. Calculate and report the total number of missing values in the dataset (i.e. the total number of rows with NAs)
64+
## Imputing missing values
65+
66+
1. Calculate and report the total number of missing values in the dataset (i.e. the total number of rows with NAs)
67+
5468
```{r}
5569
length(which(is.na(data1$steps)))
56-
```
57-
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.
70+
```
71+
72+
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.
73+
74+
75+
76+
3. Create a new dataset that is equal to the original dataset but with the missing data filled in.
5877

59-
3. Create a new dataset that is equal to the original dataset but with the missing data filled in.
6078

6179

6280
```{r}
@@ -74,7 +92,9 @@ for (i in 1:nrow(data2)){
7492
```
7593

7694

77-
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?
95+
96+
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?
97+
7898

7999
```{r}
80100
steps_total<-aggregate((data2$steps), by=list(date=data2$date), sum)
@@ -87,9 +107,10 @@ median(steps_total$x)
87107
```
88108

89109

90-
## Are there differences in activity patterns between weekdays and weekends?
110+
## Are there differences in activity patterns between weekdays and weekends?
111+
112+
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.
91113

92-
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.
93114
```{r}
94115
data2$day<-weekdays(data2$date,abbreviate=TRUE)
95116

@@ -102,8 +123,11 @@ for (i in 1:nrow(data2)) {
102123
}
103124
}
104125
data2$day <- as.factor(data2$day)
105-
```
106-
2. 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).
126+
```
127+
128+
2. 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).
129+
130+
107131
```{r}
108132
head(data2)
109133

@@ -116,6 +140,4 @@ p2 <- ggplot(data_summ, aes(x=interval, y=steps)) +
116140
ylab("Number of steps")
117141
p2
118142

119-
120-
121143
```

.Rproj.user/F3EFA60F/sources/s-3B72DEC4/lock_file

Whitespace-only changes.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/F3EFA60F1CD2FEFF/chunks.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c455oad1jn6ic/000002.csv

Lines changed: 0 additions & 6 deletions
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c4faqzgno49m5/000003.metadata

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c4m6ttb333jx0/000005.metadata

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c4m6ttb333jx0/000006.csv

Lines changed: 0 additions & 5 deletions
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c4m6ttb333jx0/000007.metadata

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c4m6ttb333jx0/000008.csv

Lines changed: 0 additions & 10 deletions
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/c7fhsn4zqnlcj/000002.csv

Lines changed: 0 additions & 11 deletions
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/cgziox33w0rby/000002.csv

Lines changed: 0 additions & 21 deletions
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/cgziox33w0rby/000003.error

Lines changed: 0 additions & 1 deletion
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/chunks.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/cmpnzyq0rf95u/000002.csv

Lines changed: 0 additions & 6 deletions
This file was deleted.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/csilrtxmhmlrk/000005.metadata

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/cxk1n80u88z2b/000002.metadata

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

.Rproj.user/shared/notebooks/852AE9F4-PA1_template/1/s/cyoolcosgtazc/000002.metadata

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"chunk_definitions":[],"doc_write_time":1612983207}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"chunk_definitions":[],"doc_write_time":1612983207}

.Rproj.user/shared/notebooks/paths

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
C:/Users/cliver/Downloads/R/RepData_PeerAssessment1/PA1_template.Rmd="852AE9F4"
1+
C:/Users/cliver/Downloads/R/git/RepData_PeerAssessment1-1/PA1_template.Rmd="C91D8AD5"

0 commit comments

Comments
 (0)