-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_runs.Rmd
46 lines (31 loc) · 1.34 KB
/
plot_runs.Rmd
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
---
title: "plot events file"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*.
```{r}
library(xlsx)
sportlog=read.xlsx("c:/Users/tams00/Documents/git/Randgit/data/Sport_2018.xlsx",sheetName="2018")
```
```{r}
runevents=sportlog[!is.na(sportlog$Run) & !is.na(sportlog$Dist..mi.),]
```
```{r}
library(ggplot2)
week.dist=aggregate(list(dist = runevents$Dist..mi.),
list(date = cut(runevents$Date, "1 week")),
sum)
# geom_point(shape=1) + # Use hollow circles
week.dist$date=as.Date(week.dist$date)
plot(week.dist$date, week.dist$dist)
# data=week.dist,aes(x=date, y=dist,group = 1))+
# geom_line(color="blue")+
# geom_point(data=runevents, aes(x=Date, y=Dist..mi.))+
# geom_smooth(data=runevents, aes(x=Date, y=Dist..mi.),color = "red")
```
```{r}
# plot kcal with labs(color=Type)
```
Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Ctrl+Alt+I*.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Ctrl+Shift+K* to preview the HTML file).