Skip to content

Instantly share code, notes, and snippets.

Avatar

Sarah popovs

View GitHub Profile
@popovs
popovs / turkey_map.R
Created December 8, 2022 02:47
Wild turkey (Meleagris gallopavo) sightings in BC
View turkey_map.R
# Interactive Wild Turkey (Meleagris gallopavo, B-WITU) map
# 00 SETUP ====
library(magrittr) # for %>%
# Set up reproducible renv environment so anyone using this code
# will achieve the same result, regardless of machine
# This means any libraries I download now will also be downloaded
@popovs
popovs / performance_test.py
Created October 1, 2021 13:24 — forked from pmbaumgartner/performance_test.py
Django/Postgres Data Load - Performance Comparison
View performance_test.py
from contextlib import closing
from io import StringIO
from time import time
import pandas as pd
from django.core.management.base import BaseCommand
from django.db import transaction
from faker import Faker
from core.models import Thing
@popovs
popovs / snippets.R
Created February 1, 2018 23:11 — forked from mbacou/snippets.R
Working with attributes inside SpatialPolygonsDataFrame objects
View snippets.R
## Example procedure for working with data (attributes) inside SpatialPolygonsDataFrame objects
# Load my favorite libraries for that sort of work
library(data.table)
library(rgdal)
# Load 2 shapefiles that, say, we want to merge.
# Note that you can read pretty much any spatial format using readOGR().
tza.l2 <- readOGR("./analysis/TZA-AC-07/maps", "tza-ac-07_L2")
tza.l1 <- readOGR("./analysis/TZA-AC-07/maps", "tza-ac-07_L1")
View World map Robinson projection - ggplot.R
# ======================================================================================
# Create a simple world map in Robinson projection with labeled graticules using ggplot
# ======================================================================================
# Set a working directory with setwd() or work with an RStudio project
# __________ Set libraries
library(rgdal) # for spTransform() & project()
library(ggplot2) # for ggplot()