This repository has been archived by the owner on Mar 2, 2020. It is now read-only.
forked from beanumber/macleish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
95 lines (75 loc) · 3.16 KB
/
README.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
title: "MacLeish"
output:
github_document:
html_preview: true
---
[](https://travis-ci.org/beanumber/macleish)
[](https://cran.r-project.org/package=macleish)
The Ada and Archibald MacLeish Field Station is a 260-acre patchwork of forest and farmland located in West Whately, MA that provides opportunities for faculty and students to pursue environmental research, outdoor education, and low-impact recreation. More information can be found at (http://www.smith.edu/ceeds/macleish.php)

This R package allows you to download and process weather data using the [ETL](http://www.github.com/beanumber/etl) framework from the MacLeish Field Station. It also contains shapefiles for contextualizing spatial information.
## To install
```{r, eval=FALSE}
install.packages("macleish")
```
## Use 2015 weather data
Weather data from 2015 is available immediately from both the `Whately` and `Orchard` weather stations.
```{r, message=FALSE}
library(macleish)
glimpse(whately_2015)
glimpse(orchard_2015)
```
## Live weather data
Weather readings are logged every 10 minutes. Current and historical (dating back to 1/3/2012 for `whately` and 6/27/2014 for `orchard`) meteorological readings are available through the [ETL](http://www.github.com/beanumber/etl) framework. Please see the documentation for that package for more information about how this works.
```{r, message=FALSE, eval=FALSE}
macleish <- etl("macleish")
macleish %>%
etl_update()
```
```{r, eval=FALSE}
whately <- macleish %>%
tbl("whately")
whately %>%
mutate(the_year = strftime('%Y', when)) %>%
group_by(the_year) %>%
summarize(N = n(), begin = min(when), end = max(when), avg_temp = mean(temperature))
orchard <- macleish %>%
tbl("orchard")
orchard %>%
mutate(the_year = strftime('%Y', when)) %>%
group_by(the_year) %>%
summarize(N = n(), begin = min(when), end = max(when), avg_temp = mean(temperature))
```
```{r, eval=FALSE, fig.width = 7, fig.height = 5, message=FALSE}
daily <- whately %>%
mutate(the_date = date(when)) %>%
group_by(the_date) %>%
summarize(N = n(), avgTemp = mean(temperature)) %>%
collect()
library(ggplot2)
ggplot(data = daily, aes(x = as.Date(the_date), y = avgTemp)) +
geom_point() + geom_smooth()
```
## Maps
Spatial data is available through the `macleish_layers` data object.
```{r}
class(macleish_layers)
names(macleish_layers)
```
```{r, eval=FALSE, fig.width=7, fig.height=7, message=FALSE}
library(leaflet)
leaflet() %>%
addTiles() %>%
addPolygons(data = macleish_layers[["boundary"]],
weight = 1, fillOpacity = 0.1) %>%
addPolygons(data = macleish_layers[["buildings"]],
weight = 1, popup = ~ name) %>%
addPolylines(data = macleish_layers[["trails"]],
weight = 1, color = "brown",
popup = ~ name) %>%
addPolylines(data = macleish_layers[["streams"]],
weight = 2) %>%
addMarkers(data = filter(macleish_layers[["landmarks"]], grepl("Met", Label)),
popup = ~Label)
```