Skip to content

Instantly share code, notes, and snippets.

Avatar

Robby rmarrotte

View GitHub Profile
View find_ridges.R
# Clear workspace
rm(list=ls())
# Load libraries
require(rasterVis)
require(dismo)
require(GISTools)
require(spdep)
require(RColorBrewer)
View zonal_stats_parallel.R
####################################
# Run zonal statistics in parallel #
####################################
# Clear workspace
rm(list=ls())
# Libraries
library(raster)
library(gstat)
View webscrap_science_apps.R
######################
## Web scraping ##
######################
# Clear workspace
rm(list=ls())
# Load libraries
require(RCurl)
require(XML)
View MCP95_from_polygons.R
# Clear workspace
rm(list=ls())
# load libraries
library(rgeos)
library(maptools)
# Set seed
set.seed(1234)
@rmarrotte
rmarrotte / CompareEffectiveDistances.R
Last active Apr 18, 2016
Circuitscape is a tool that is used to measure effective resistance between pairs of nodes. A more recent package in R called "gdistance" can also perform a similar measurement and offers other function to measure effective distance such as cost distance. In this script I compare all 3 and include euclidean distance.
View CompareEffectiveDistances.R
# Compare CS, costDist and commuteDist
# Clear workspace
rm(list=ls())
# Load libraries
library(gdistance)
library(scales)
library(gstat)
@rmarrotte
rmarrotte / Circuitscape in R (Windows).R
Last active Dec 20, 2018
Simple script that shows how to run Circuitscape through R under Windows. It runs an examples found in the Circuitscape examples folder
View Circuitscape in R (Windows).R
########################################
#### Getting started ####
########################################
# Make a place holder for the cs_run.exe path
CS_exe <- 'C:/"Program Files"/Circuitscape/cs_run.exe' # Don't forget the "Program Files" problem
# We want to run one of the CS examples found in /examples/, first we need to fix the .ini file
# We first read in the .ini file and then we change the arguments
Example_lines <- readLines("C:/Program Files/Circuitscape/examples/eight_neighbor_example.ini")
@rmarrotte
rmarrotte / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rmarrotte
rmarrotte / Circuitscape example.R
Last active Sep 7, 2021
Simple script that shows how to run Circuitscape through R under Windows. It runs data created directly in R.
View Circuitscape example.R
######################################
#### Example Run ####
######################################
# Clear workspace
rm(list=ls())
# load raster library
library(raster)
# Make a place holder for the cs_run.exe path