Data Processing + Extracting driving bird species

latlong <- get(load("../data/LatLongCells_frame.rda"))
world_map <- map_data("world")
world_map <- world_map[world_map$region != "Antarctica",] # intercourse antarctica

world_map <- world_map[world_map$long > 110 & world_map$long < 160, ]
world_map <- world_map[world_map$lat > -50 & world_map$lat < -10, ]


p <- ggplot() + coord_fixed() +
  xlab("") + ylab("")

#Add map to base plot
base_world_messy <- p + geom_polygon(data=world_map, aes(x=long, y=lat, group=group), colour="light green", fill="light green")

cleanup <- 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
        panel.background = element_rect(fill = 'white', colour = 'white'), 
        axis.line = element_line(colour = "white"), legend.position="none",
        axis.ticks=element_blank(), axis.text.x=element_blank(),
        axis.text.y=element_blank())

base_world <- base_world_messy + cleanup

base_world

latlong <- get(load("../data/LatLongCells_frame.rda"))
idx1 <- which(latlong[,2] > -50 & latlong[,2] < -10)
idx2 <- which(latlong[,1] > 110 & latlong[,1] < 160)
idx <- intersect(idx1, idx2)
length(idx)
## [1] 791
latlong2 <- latlong[idx,]
birds_pa_data <- readRDS("../data/birds_presab_land_breeding_counts.rds")
birds_pa_data_2 <- birds_pa_data[idx, ]
birds_pa_data_3 <- birds_pa_data_2[, which(colSums(birds_pa_data_2)!=0)]
topics <- get(load("../output/Australia/methClust_6.rda"))
out <- CountClust::ExtractTopFeatures(topics$freq, top_features = 10, method = "poisson", options = "max")

Presence-absence patterns of top driving birds

PlotAssemblageIdx <- function(idx){
  dat <- cbind.data.frame(latlong2, birds_pa_data_3[,idx])
colnames(dat) <- c("Latitude", "Longitude", "Value")
map_data_coloured <- 
  base_world +
  geom_point(data=dat, 
             aes(x=Latitude, y=Longitude, colour=Value), size=0.5) +
  scale_colour_gradient(low = "white", high = "black") 

map_data_coloured
}

First cluster

par(mfrow = c(3,2))
PlotAssemblageIdx(out$indices[1,1])

PlotAssemblageIdx(out$indices[1,2])

PlotAssemblageIdx(out$indices[1,3])

PlotAssemblageIdx(out$indices[1,4])

PlotAssemblageIdx(out$indices[1,5])

PlotAssemblageIdx(out$indices[1,6])

Second cluster

par(mfrow = c(3,2))
PlotAssemblageIdx(out$indices[2,1])

PlotAssemblageIdx(out$indices[2,2])

PlotAssemblageIdx(out$indices[2,3])

PlotAssemblageIdx(out$indices[2,4])

PlotAssemblageIdx(out$indices[2,5])

PlotAssemblageIdx(out$indices[2,6])

Third cluster

par(mfrow = c(3,2))
PlotAssemblageIdx(out$indices[3,1])

PlotAssemblageIdx(out$indices[3,2])

PlotAssemblageIdx(out$indices[3,3])

PlotAssemblageIdx(out$indices[3,4])

PlotAssemblageIdx(out$indices[3,5])

PlotAssemblageIdx(out$indices[3,6])

Fourth cluster

par(mfrow = c(3,2))
PlotAssemblageIdx(out$indices[4,1])

PlotAssemblageIdx(out$indices[4,2])

PlotAssemblageIdx(out$indices[4,3])

PlotAssemblageIdx(out$indices[4,4])

PlotAssemblageIdx(out$indices[4,5])

PlotAssemblageIdx(out$indices[4,6])

Fifth cluster

par(mfrow = c(3,2))
PlotAssemblageIdx(out$indices[5,1])

PlotAssemblageIdx(out$indices[5,2])

PlotAssemblageIdx(out$indices[5,3])

PlotAssemblageIdx(out$indices[5,4])

PlotAssemblageIdx(out$indices[5,5])

PlotAssemblageIdx(out$indices[5,6])

Sixth cluster

par(mfrow = c(3,2))
PlotAssemblageIdx(out$indices[6,1])

PlotAssemblageIdx(out$indices[6,2])

PlotAssemblageIdx(out$indices[6,3])

PlotAssemblageIdx(out$indices[6,4])

PlotAssemblageIdx(out$indices[6,5])

PlotAssemblageIdx(out$indices[6,6])

Driving species names

Cluster 1

rownames(topics$freq)[out$indices[1,1:10]]
##  [1] "Cinclosoma cinnamomeum"   "Eremiornis carteri"      
##  [3] "Geophaps ferruginea"      "Geophaps plumifera"      
##  [5] "Stipiturus ruficeps"      "Stiltia isabella"        
##  [7] "Phaps histrionica"        "Cheramoeca leucosterna"  
##  [9] "Lichenostomus keartlandi" "Pardalotus rubricatus"

Cluster 2

rownames(topics$freq)[out$indices[2,1:10]]
##  [1] "Aphelocephala leucopsis"    "Aphelocephala nigricincta" 
##  [3] "Neopsephotus bourkii"       "Psephotellus varius"       
##  [5] "Acanthiza robustirostris"   "Cinclosoma castanotum"     
##  [7] "Climacteris affinis"        "Pyrrholaemus brunneus"     
##  [9] "Pomatostomus superciliosus" "Conopophila whitei"

Cluster 3

rownames(topics$freq)[out$indices[3,1:10]]
##  [1] "Acanthiza inornata"            "Acanthorhynchus superciliosus"
##  [3] "Manorina melanotis"            "Pachycephala rufogularis"     
##  [5] "Phaethon rubricauda"           "Polytelis anthopeplus"        
##  [7] "Zanda baudinii"                "Ixobrychus dubius"            
##  [9] "Melithreptus brevirostris"     "Malurus splendens"

Cluster 4

rownames(topics$freq)[out$indices[4,1:10]]
##  [1] "Calonectris leucomelas"   "Caprimulgus macrurus"    
##  [3] "Certhionyx pectoralis"    "Ceyx azureus"            
##  [5] "Chlamydera nuchalis"      "Climacteris melanurus"   
##  [7] "Egretta picata"           "Gerygone levigaster"     
##  [9] "Heteromunia pectoralis"   "Melithreptus albogularis"

Cluster 5

rownames(topics$freq)[out$indices[5,1:10]]
##  [1] "Anthochaera chrysoptera"  "Calyptorhynchus lathami" 
##  [3] "Chlamydera maculata"      "Coracina lineata"        
##  [5] "Malurus cyaneus"          "Manorina melanocephala"  
##  [7] "Podargus ocellatus"       "Sericulus chrysocephalus"
##  [9] "Zanda funerea"            "Rhipidura rufifrons"

Cluster 6

rownames(topics$freq)[out$indices[6,1:10]]
##  [1] "Thalassarche salvini"  "Puffinus assimilis"   
##  [3] "Daption capense"       "Thalassarche cauta"   
##  [5] "Macronectes halli"     "Puffinus huttoni"     
##  [7] "Thalassarche steadi"   "Macronectes giganteus"
##  [9] "Diomedea antipodensis" "Pterodroma macroptera"

This R Markdown site was created with workflowr