-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample_markdown.Rmd
More file actions
119 lines (89 loc) · 3.02 KB
/
Example_markdown.Rmd
File metadata and controls
119 lines (89 loc) · 3.02 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
title: "Project presentations and rmarkdown example"
output:
pdf_document:
highlight: tango
number_sections: yes
toc: yes
html_document:
highlight: tango
number_sections: yes
theme: cerulean
toc: yes
toc_float: yes
urlcolor: blue
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Project presentations
Ignite format: 5 minutes presentations (20 slides, 15 seconds each)
You can find some advice and examples [here](http://scottberkun.com/2009/how-to-give-a-great-ignite-talk/) and [here](http://scottberkun.com/2009/how-to-give-a-great-ignite-talk/)
Presentations must include:
1. Title
2. Description of main aim or question
3. Brief methods description (Main data sources and methods)
4. A brief description of your data (e.g., table, map, plot showing the number of species, areas, etc.)
5. Primary results and a brief discussion
AVOID to include unnecessary code into the R markdown. Code for data downloading and cleaning should be incorporated into a separate R file. Start the document with the clean, processed and merge data.
# Project Rmarkdown
# Example: Life history traits and distribution of Hyraxes
```{r libraries, message=FALSE, warning=FALSE}
# Include here your libraries
library(knitr)
library(tidyverse)
library(maptools)
library(ggpubr)
```
## Introduction
- A brief background
- The main question or aim of the project
## Methods
- [Github repository link](https://github.com/GlobalEcologyBiogeography/Rmarkdown_assignment_example)
- Data sources
- Data cleaning and processing
- Describe main procedures
- Data summary (how many species? which groups? how many records?...)
### Data description
```{r}
## Data decription
Hyraxes_df<-read.csv("data/processed/Hyracoidea_traits_geo.csv")
Hyraxes_df %>%
group_by(genus,species) %>%
tally() %>%
kable()
```
### Data distribution
```{r}
# Distribution
Hyraxes_df_geo<-Hyraxes_df
coordinates(Hyraxes_df_geo)<-~lon + lat
# Get map and change projection
data(wrld_simpl)
proj4string(wrld_simpl)<-proj4string(Hyraxes_df_geo)
# Colour vector
cols<-c("#00AFBB", "#E7B800", "#FC4E07","grey")
cols_sp<-cols[Hyraxes_df$Binomial]
# Plot map and species distribution
plot(wrld_simpl, xlim=c(min(Hyraxes_df$lon)-1,max(Hyraxes_df$lon)+1),
ylim=c(min(Hyraxes_df$lat)-1,max(Hyraxes_df$lat)+1), axes=TRUE, col="light yellow")
points(Hyraxes_df_geo,col=cols_sp, pch=20)
legend('bottomright', bty='n', legend=unique(Hyraxes_df$Binomial),
cex=0.8, fill=unique(cols_sp))
```
## Results and Discussion
```{r message=FALSE, warning=FALSE}
p <- ggplot(Hyraxes_df, aes(temp, precip)) +
geom_point(aes(color = Binomial), size = 3, alpha = 0.7) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07","grey"))+
xlab("Temperature C") +
ylab("Precipitation")
# Grouped Scatter plot with marginal density plots
ggscatterhist(
Hyraxes_df, x = "temp", y = "precip",
color = "Binomial", size = 3, alpha = 0.6,
palette = c("#00AFBB", "#E7B800", "#FC4E07","grey"),
margin.plot = "boxplot",
ggtheme = theme_bw()
)
```