library(parallel)
library(doMC)
registerDoMC(cores=round(detectCores()))
library(STREM)
source("~/git/STREM/setup/WTC-Boot.R")
library(ggplot2)
plotMovementHabitatDistribution <- function(response) {
context <- Context$new(resultDataDirectory=wd.data.results, processedDataDirectory=wd.data.processed, rawDataDirectory=wd.data.raw, scratchDirectory=wd.scratch, figuresDirectory=wd.figures)
study <- FinlandWTCStudy$new(context=context)
study$response <- response
tracks <- study$loadTracks()
habitatWeights <- CORINEHabitatWeights$new(study=study)
xy <- ld(tracks$tracks)[,c("x","y")]
habitatValues <- raster::extract(study$studyArea$habitat, xy)
classifiedHabitatValues <- habitatWeights$weights$type[habitatValues]
classifiedHabitatValues <- factor(classifiedHabitatValues, levels=habitatWeights$habitatTypes, labels=names(habitatWeights$habitatTypes))
ggplot(data.frame(classifiedHabitatValues), aes(x=classifiedHabitatValues)) + geom_bar()
}
plotMovementHabitatDistribution("canis.lupus")
plotMovementHabitatDistribution("lynx.lynx")
plotMovementHabitatDistribution("rangifer.tarandus.fennicus")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.