Skip to content

Instantly share code, notes, and snippets.

View lehostert's full-sized avatar

Lauren Hostert lehostert

  • National Ecological Observatory Network (NEON)
  • Denton, TX
View GitHub Profile
@lehostert
lehostert / README.md
Last active March 23, 2021 04:23
stacked bar plots

Stacked Bar Plot Example

Summary

This is an example of how to create a stacked bar plot with percent family from a fish data set. Using this example you will be able to take a full data set and compute the family proportions just before plotting without the need to save a new dataframe.

Dependencies

This is dependent on the dplyr and ggplot2 libraries.

@lehostert
lehostert / README.md
Last active October 2, 2021 20:29
List of helpful hotkeys to use on a PC, in R, or in a terminal

Keyboard Shortcuts

PC

Bash

  • man <command> = open the manual for any linux command (e.g. man git would give you the manual for git)
  • <command> --help = condensed version of linux command manuals
  • history | grep "SEARCH TERM HERE" = Finding specific phrases in terminal history using grep
  • Ctrl + l = shortcut for "clear"
  • Ctrl + r = reverse interative search to search backwords through your executed commands
@lehostert
lehostert / gauge_loops.R
Last active May 6, 2021 21:02
read and summarize USGS gauge data
#### For Loop ####
setwd("~/GitHub/Gists/gauge_summary/data")
### This is an example of using the tidyverse with functional programming to get a df/ tibble of the gauges called "gauge list"
### THis is a tibble/dataframe and not a list
gauge_list <- sites %>%
select(gauge_station) %>%
unique()
@lehostert
lehostert / deg-dec-min-to-dec-deg.R
Last active July 26, 2021 16:53
Convert Geo Coordinates from Degree-Decimal-Minutes to Decimal-Degrees
## Example function for converting geo coordinates from degree-decimal minutes to decimal degrees.
## For full discussion please see StackOverflow #14404596
## https://stackoverflow.com/questions/14404596/converting-geo-coordinates-from-degree-to-decimal
library(tidyr)
library(dplyr)
df <- tribble(
~site, ~lat, ~lon,
"105252", "30°25.264", "9°01.331",