Skip to content

Instantly share code, notes, and snippets.

View amdevine's full-sized avatar

Amanda Devine amdevine

  • Washington, D.C.
View GitHub Profile
@amdevine
amdevine / translate.ipynb
Created February 12, 2021 21:25
Translate characters to strings in Python with `str.maketrans()` and `str.translate()`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amdevine
amdevine / ecoregion_70.geojson
Last active March 20, 2020 20:11
Spalding Ecoregion 70: Floridian. First file is original ER 70, second file is ER 70 with terrestrial Florida subtracted (resolution of 500k), third file is ER 70 with terrestrial Florida subtracted (resolution of 20m).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amdevine
amdevine / dc_sql_ecology.md
Last active August 12, 2020 11:22
Data Carpentry: SQL
@amdevine
amdevine / dc_python_ecology_1.md
Last active August 30, 2021 19:23
Data Carpentry: Python Day 1

Data Carpentry: Python Day 1

These notes are adapted from the official Carpentries documentation for Data Analysis and Visualization in Python for Ecologists: Before we start. They have been reordered, and some material has been expanded on, and there are some Smithsonian-specific details incorporated. The original lessons are licensed under CC-BY 4.0 2018–2020 by The Carpentries. These adapted notes are available for use under the same license.

Links

Official lesson link: https://datacarpentry.org/python-ecology-lesson/

Jupyter documentation: https://datacarpentry.org/python-ecology-lesson/jupyter_notebooks/

@amdevine
amdevine / vertebrate-classes.md
Last active April 7, 2021 17:17
Vertebrate Classes

Vertebrate Classes

This gist contains all classes that occur in phylum Chordata for each data source, and whether these classes would be classified as vertebrates for the purpose of analysis.

Catalogue of Life

Class Vertebrate? Category
Actinopterygii Yes Fishes
Amphibia Yes Amphibians and Reptiles
@amdevine
amdevine / terrestrial-arthropods.md
Last active April 2, 2020 19:16
Terrestrial Arthropod Classes

Terrestrial Arthropod Classes

This gist contains all classes that occur in phylum Arthropoda for each data source, and whether these classes would be classified as "terrestrial arthropods" when doing analyses.

Catalogue of Life

Class Terrestrial Arthropod
Arachnida Yes
Branchiopoda No
@amdevine
amdevine / change-values-column.R
Created December 12, 2019 20:26
Change values in a column of an R data frame
library(tidyverse)
#### Changing the values in a character/numeric vector ####
# Create sample data frame
df <- data.frame(
col1 = c("A", "A", "A", "A", "B", "B", "B", "B"),
col2 = c("C", "C", "D", "D", "C", "C", "D", "D"),
col3 = c("E", "F", "E", "F", "E", "F", "E", "F"),
stringsAsFactors = FALSE
@amdevine
amdevine / .block
Created September 13, 2019 21:35 — forked from kerryrodden/.block
Sequences sunburst (d3 v4)
license: apache-2.0
@amdevine
amdevine / clone-remote-branches.md
Created July 23, 2019 17:29
Clone remote branches in Git

Text was taken from Stackoverflow, user emk. https://stackoverflow.com/a/72156

First, clone a remote Git repository and cd into it:

$ git clone git://example.com/myproject
$ cd myproject

Next, look at the local branches in your repository:

@amdevine
amdevine / dc-sql-cheat-sheet.md
Last active November 23, 2020 02:51
Data Carpentry SQL Cheat Sheet

Data Carpentry - SQL Cheat Sheet

Query order of operations

SELECT tablea.column1, tablea.column2, tableb.column3 AS somealias, SUM(tableb.column4)
FROM tablea
LEFT JOIN tableb
ON tablea.columnx = tableb.columnx
WHERE (tablea.column1 = 'someString') AND (tablea.column2 = someNumber)