## Compare sites: species richness
# Compute the number of species at each site
# To sum by rows, the second argument of apply(), MARGIN, is
# set to 1
sit.pres <- apply(spe > 0, 1, sum)
# Sort the results in increasing order
sort(sit.pres)
par(mfrow = c(1, 2))
# Plot species richness vs. position of the sites along the river
plot(sit.pres,type = "s",
las = 1,
col = "gray",
main = "Species Richness vs. \n Upstream-Downstream Gradient",
xlab = "Site numbers",
ylab = "Species richness"
)
text(sit.pres, row.names(spe), cex = .8, col = "red")
# Use geographic coordinates to plot a bubble map
plot(spa,
asp = 1,
main = "Map of Species Richness",
pch = 21,
col = "white",
bg = "brown",
cex = 5 * sit.pres / max(sit.pres),
xlab = "x coordinate (km)",
ylab = "y coordinate (km)"
)
lines(spa, col = "light blue")
0
5
10
15
20
25
30
0
5
10
15
20
25
Species Richness vs.
Upstream-Downstream Gradient
Site numbers
Species richness
1
2
3
4
5
6
7
8
9
10111213
14
15
16
17
1819
20
21
22
23
2425
26
2728
29
30
0
50
100
150
20
40
60
80 100
Map of Species Richness
x coordinate (km)
y coordinate (km)
Fig. 2.5 Species richness along the river
20
2 Exploratory Data Analysis
Précédent

- 34/444

Suivant