Chapter 3 Data summary

load("data/data.Rdata")

Summary of sampled individuals and analysed faecal samples.

#number of samples
length(sample_metadata$EHI_number)
[1] 105
#number of samples by transect
sample_metadata %>%
  group_by(Transect) %>%
  summarise(n_samples = length(EHI_number)) %>%
  tt()
Transect n_samples
Aisa 22
Aran 37
Sentein 19
Tourmalet 27
#number of samples by transect and elevation
sample_metadata %>%
  group_by(Transect, Elevation) %>%
  summarise(n_samples = length(EHI_number)) %>%
  tt()
Transect Elevation n_samples
Aisa 1250 6
Aisa 1450 6
Aisa 1650 4
Aisa 1850 6
Aran 1000 6
Aran 1080 7
Aran 1340 5
Aran 1500 6
Aran 1650 7
Aran 1850 6
Sentein 941 5
Sentein 1260 4
Sentein 1628 5
Sentein 1873 5
Tourmalet 953 5
Tourmalet 1255 4
Tourmalet 1561 4
Tourmalet 1797 4
Tourmalet 2065 2
Tourmalet 2134 3
Tourmalet 2306 5
#n of analysed faecal samples
ncol(read_counts)
[1] 106

Geographical location of sampled lizards in the Pyrenees.

#Summarise for generating map
options(dplyr.summarise.inform = FALSE)
sample_metadata_summary <- sample_metadata %>%
  #Group by geography and count samples
  select(EHI_number, latitude, longitude, Transect) %>%
  group_by(latitude, longitude, Transect) %>%
  summarize(count = n()) %>%
  ungroup()

#plotting on map
## Determine the longitude and latitude ranges
lon_range <- range(sample_metadata_summary$longitude, na.rm = TRUE)
lat_range <- range(sample_metadata_summary$latitude, na.rm = TRUE)

sample_metadata_summary %>%
  ggplot(.) +
  #render map
  geom_map(
    data=map_data("world"),
    map = map_data("world"),
    aes(long, lat, map_id=region),
    color = "white", fill = "#cccccc", linewidth = 0.2
  ) +
  #render points
  geom_point(
    aes(x=longitude,y=latitude, color=Transect),
    alpha=0.5, shape=16) +
  #add general plot layout
  theme_minimal() +
  theme(legend.position = "right",
        axis.title.x=element_blank(),
        axis.title.y=element_blank()
  ) + coord_map("mercator", xlim = lon_range, ylim = lat_range)