-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmyproject.Rmd
65 lines (42 loc) · 978 Bytes
/
myproject.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: "Does sunshine make people happy?"
author: "F. Rodriguez-Sanchez"
date: "Thursday, 17 November 2016"
output: word_document
---
Introduction
------------
It is well known that individual well-being can be influenced by climatic conditions. However, ...
Methods
-------
```{r echo=FALSE}
## Read data
data <- read.table("data.txt", header=T)
#data[10,1] <- 11 # correct error
# Fit linear model
model <- lm(happiness ~ sunshine, data=data)
```
We collected data on `r nrow(data)` individuals and fitted a linear model.
Results
-------
We found that...
```{r echo=FALSE, results='asis'}
# Print results
library(xtable, quietly=T)
library(knitr)
kable(xtable(model))
```
```{r echo=FALSE}
# Plot
library(visreg, quietly=T)
visreg(model)
```
Discussion
----------
These results confirm that sunshine is good for happiness (slope = `r coef(model)[2]`).
Acknowledgements
----------------
Y. Xie, J. MacFarlane, Rstudio...
```{r}
sessionInfo()
```