################################ #### threat diversity per species - global and island scale #### diversity = total number of threats at the smallest level (5.1.1) #### last update: 13/12/19 - version of ICUN 2019-3 #### #### author: Lucile Leveque (lucile.leveque@utas.edu.au) #### used in article "Characterising the spatio-temporal threats, conservation hotspots, #### and conservation gaps for the most extinction-prone bird family (Aves: Rallidae)" #### 2021 ################################ # integrates IUCN 2019 update for Black rail, Weka, Laterallus levraudi, # Baillon's crake, Barred rail and Guam rail #### functions std <- function(x) sd(x, na.rm=T)/sqrt(length(x)) library("dplyr") library("ggplot2") # THREAT DIVERSITY threatdiv <- as.data.frame(read.table("threatdiv2.csv", header =T, sep=",", na.strings ="N/A")) threatdiv %>% filter(iucn=="T" & island_ende=="yes") # 22 T island ende threatdiv %>% filter(iucn=="T" & flightless=="flightless") # 13 flightless threatened # how many species of each - play with it to work out each category threatdiv %>% filter(iucn == "NoT" & island_ende == "yes") %>% summarise(length(common.name)) # Threat diveristy - all sp combined summary(threatdiv$threatdiv) # gobally, all species mean(threatdiv$threatdiv) std(threatdiv$threatdiv) # island and continents, (all sp. combined) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende), FUN=summary) # Continental and islands, overall (all species regardless) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende), FUN=summary) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende), FUN=mean) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende), FUN=std) # Globally, T and NoT aggregate(x= threatdiv$threatdiv, by= list(threatdiv$iucn), FUN=summary) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$iucn), FUN=mean) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$iucn), FUN=std) # Continental (no) and islands (yes), T and NoT aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende, threatdiv$iucn), FUN=summary) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende, threatdiv$iucn), FUN=mean) aggregate(x= threatdiv$threatdiv, by= list(threatdiv$island_ende, threatdiv$iucn), FUN=std) # store results df <- as.data.frame(matrix(vector(),7, 4)) colnames(df) <- c("scale", "type", "mean", "SE") df[,1] <- c("gl.combined", "global", "global", "continent", "continent", "island", "island") df[,2] <- c("combined", "globalT", "globalNoT", "continent-T", "continent-NoT", "island-T", "island-NoT") df[,3] <- c(2.0, 4.7, 1.1, 6.2, 0.9, 4.0, 1.8) df[,4] <- c(0.2, 0.4, 0.2, 0.8, 0.2, 0.5, 0.4) # write.csv(df, "summary means table.csv")