The use of the highlight (‘text’) will be reserved for denoting code.
To add emphasis to other text, use bold or italics
You can specify the following
Unordered list item * Unordered list item
Ordered list item 1. Ordered list item
Website link Google
Equation \(A =\pi \times r^{2}\)
This is how you waould add H. Wickham as an in-text citation
After a statement:
(Wickham, 2011)
Date only after author name:
(2011)
Multiple references:
(Wickham, 2011; Wickham, Cook, Hofmann, Buja, & others, 2011)
Headings and sub-headings are created by using the pound (#) symbol followed by a space.
Main Heading
Sub-heading 1
Sub-heading 2
#Create dummy data
A <- c("a", "a", "b", "b")
B <- c(5, 10, 15,20)
dataframe <- data.frame(A, B)
#Plot figure
boxplot(B~A, data = dataframe)

library(knitr)
kable(dataframe, digits = 2)
#install.packages(pander)
library(`pander`)
## Warning: package 'pander' was built under R version 4.0.4
plant <- c("a", "b", "c")
temperature <- c(20, 20, 20)
growth <- c(0.65, 0.95, 0.15)
dataframe <- data.frame(plant, temperature, growth)
emphasize.italics.cols(3) # Make the 3rd column italics
pander(dataframe) # Create the table
a |
20 |
0.65 |
b |
20 |
0.95 |
c |
20 |
0.15 |
Data Exploration
A preliminary investigation into the biodiversity of Edinburgh, using data from the NBN Gateway.
What is the species richness across taxonomic groups?
A table of species richness:
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
richness <-
edidiv %>%
group_by(taxonGroup) %>%
summarise(Species_richness = n_distinct(taxonName))
pander(richness)
Beetle |
37 |
Bird |
86 |
Butterfly |
25 |
Dragonfly |
11 |
Flowering.Plants |
521 |
Fungus |
219 |
Hymenopteran |
112 |
Lichen |
94 |
Liverwort |
40 |
Mammal |
33 |
Mollusc |
97 |
A barplot of the table above:
barplot(richness$Species_richness,
names.arg = richness$taxonGroup,
xlab="Taxa", ylab="Number of species",
ylim=c(0,600)
)

What is the most common species in each taxonomic group?
A table of the most common species:
#Create a vector of most abundant species per taxa
max_abund <-
edidiv %>%
group_by(taxonGroup) %>%
summarise(taxonName = names(which.max(table(taxonName))))
#Add the vector to the data frame
richness_abund <-
inner_join(richness, max_abund, by = "taxonGroup")
richness_abund <- rename(richness_abund, Most_abundant = taxonName, Taxon = taxonGroup)
richness_abund <- rename(richness_abund,
"Most Abundant" = Most_abundant,
"Species Richness" = Species_richness) #Change the column names
emphasize.italics.cols(3) #Make the 3rd column italics
pander(richness_abund) #Create a table
Beetle |
37 |
Coccinella septempunctata |
Bird |
86 |
Turdus merula |
Butterfly |
25 |
Maniola jurtina |
Dragonfly |
11 |
Ischnura elegans |
Flowering.Plants |
521 |
Urtica dioica |
Fungus |
219 |
Auricularia auricula-judae |
Hymenopteran |
112 |
Bombus (Bombus) terrestris |
Lichen |
94 |
Xanthoria parietina |
Liverwort |
40 |
Lophocolea bidentata |
Mammal |
33 |
Sciurus carolinensis |
Mollusc |
97 |
Cornu aspersum |
Wickham, H. (2011). ggplot2. Wiley Interdisciplinary Reviews: Computational Statistics, 3(2), 180–185.
Wickham, H., Cook, D., Hofmann, H., Buja, A., & others. (2011). Tourr: An r package for exploring multivariate data with projections. Journal of Statistical Software, 40(2), 1–18.