This repository has been archived by the owner on Sep 23, 2022. It is now read-only.
forked from rdpeng/RepData_PeerAssessment1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
63 lines (63 loc) · 2.5 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
library(xtable)
xtabel(subset(steps, select = c(date,Totalsteps)))
xtable(subset(steps, select = c(date,Totalsteps)))
library(ggplot2)
library(xtable)
knitr::opts_chunk$set(cache = TRUE)
library(ggplot2)
library(dplyr)
library(xtable)
activity <- read.csv("activity.csv")
activity <- transform(activity, date = as.Date(activity$date, "%Y-%m-%d"))
steps <- activity %>% group_by(date) %>% summarise(Totalsteps = sum(steps), Mean = mean(steps), Median = median(steps))
xtable(subset(steps, select = c(date,Totalsteps)))
subset(steps, select = c(date,Totalsteps))
xtable(as.matrix(subset(steps, select = c(date,Totalsteps))))
print(xtable(subset(steps, select = c(date,Totalsteps), type = "html", sanitize.text.function = identity)
print(xtable(subset(steps, select = c(date,Totalsteps)), type = "html", sanitize.text.function = identity)
print(xtable(subset(steps, select = c(date,Totalsteps)),
type = "html"))
unlink('PA1_template_cache', recursive = TRUE)
xt <- xtable(as.matrix(steps))
print(xt, type = "html")
View(xt)
```{r results='asis'}
View(xt)
unlink('PA1_template_cache', recursive = TRUE)
print(xt, type = "html", include.rownames = FALSE)
stepsxt <- transform(steps, date = as.character(steps$date))
View(stepsxt)
xt <- xtable(stepsxt)
print(xt, type = "html", include.rownames = FALSE)
knitr::opts_chunk$set(cache = TRUE)
library(ggplot2)
library(dplyr)
library(xtable)
activity <- read.csv("activity.csv")
activity <- transform(activity, date = as.Date(activity$date, "%Y-%m-%d"))
steps <- activity %>% group_by(date) %>% summarise(Totalsteps = sum(steps), Mean = mean(steps), Median = median(steps))
stepsxt <- transform(steps, date = as.character(steps$date))
xt <- xtable(stepsxt)
print(xt, type = "html", include.rownames = FALSE)
barplot(steps$Totalsteps, space = 0, names.arg = steps$date,
xlab = "Date",
ylab = "Number of steps",
main = "Total number of steps")
interval <- activity %>% group_by(interval) %>% summarise(Mean = mean(steps, na.rm = TRUE))
plot(interval, type = "l",
xlab = "Interval",
ylab = "Number of steps",
main = "Average daily activity pattern")
index <- which.max(interval$Mean)
interval[index,]
index <- which.max(interval$Mean)
xtable(interval[index,])
index <- which.max(interval$Mean)
xtable(interval[index,], type = "html")
stepsxt <- transform(steps, date = as.character(steps$date))
xt <- xtable(stepsxt)
print(xt, type = "html", include.rownames = FALSE)
index <- which.max(interval$Mean)
print(xtable(interval[index,]), type = "html")
sum(is.na(activity$steps))
unlink('PA1_template_cache', recursive = TRUE)