-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-spin.R
37 lines (31 loc) · 1.13 KB
/
test-spin.R
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
#'
#' # Crickets dataset
#'
#' ## Our question: Do crickets chirp more when it is hotter?
#'
#' ### Striped Ground Crickets
#'
#' <img src='http://previews.123rf.com/images/izakowski/izakowski1012/izakowski101200030/8489857-funny-grasshopper-Stock-Vector-cartoon-cricket-grasshopper.jpg' width='400'/>
#'
#' ## What do they sound like?
#' <iframe src="http://player.vimeo.com/video/81114843" height="200" width="680" allowfullscreen="" frameborder="0"></iframe>
#'
#' ## Taking a look at the data
#+ plot-it, include = TRUE
require(ggplot2)
d <- read.table('crickets.csv', sep=',', header=TRUE)
#' ## Taking a look at the data
#+ print-it, include = TRUE
d <- d[1:5, ]
print(d)
#' ## scatterplot of temperature by chirps per second
#+ scatterplot, include = TRUE
ggplot(data=d, aes(x=Chirpspersecond, y=Temperature)) + geom_point() + geom_smooth(method='lm', se=FALSE)
#' ### Are temperature and chirps per second related?
#+ question, include = TRUE
mod <- lm(Temperature ~ Chirpspersecond, data=d)
#' Let's take a look!
#+ load-stargazer, include = F
require(stargazer)
#+ quick-look, include = TRUE, results='asis'
stargazer(mod, type='html')