Skip to content

Instantly share code, notes, and snippets.

@sdtaylor
sdtaylor / proj4sting.md
Last active June 4, 2020 02:18
Species and species ID's for USGS Tree Range shapefiles, https://www.fs.fed.us/nrs/atlas/littlefia/#

Paneer Sak

  • 1 pound (450 grams) fresh spinach, washed and steamed
  • 2 pinches asafetida
  • 1 tablespoons ghee or vegetable oil
  • 3 tablespoons water
  • 2 teaspoons ground coriander
  • 2/3 cup (150 milliliter) sour cream (optional
  • 1/2 teaspoon turmeric
  • 8 ounce (225 grams) paneer, cubed
  • 1/4 teaspoon cayenne pepper
@sdtaylor
sdtaylor / windows_dir
Created April 11, 2017 16:11
R Windows directory stuff
> path.expand('~')
[1] "C:/Users/shawntaylor/Documents"
> normalizePath(path.expand('~'))
[1] "C:\\Users\\shawntaylor\\Documents"
> wd = getwd()
> wd
[1] "C:/Users/shawntaylor/Documents/portalPredictions"
> path.expand(wd)
[1] "C:/Users/shawntaylor/Documents/portalPredictions"
> normalizePath(path.expand(wd))

Sunrise

Oh sunrise, you must be so lonely.
Hardly a soul spends time with you
before you coalesce into the day.

Your sister, sunset, is the Hollywood star
everyone knows. Yet sunrise, you are
just a hometown hero for early risers.

@sdtaylor
sdtaylor / dplyr_lession.R
Created February 13, 2017 21:52
R Workshop dplyr() lesson
library(dplyr)
library(tidyr)
shrub_data<-read.csv("~/dplyrLesson/shrub_volume_experiment.csv")
########################
#some basics
#######################
#ordering rows!
#no more using shrub_data=shrub_data[order(shrub_data$site),]
@sdtaylor
sdtaylor / function.R
Created February 8, 2017 22:31
Use dplyr inside a function with arbitray column names
#Use dplyr inside a function with arbitray column names
#The dots stuff is from the internal workings of dplyr
#Don't forget the _ at the end of the group by.
#Other function also have the _ variation with the .dots argument available,
#but when I first made this in early 2016 not all of them did.
my_function=function(original_df, variables){
dots=lapply(variables, as.symbol)
summarized_data = original_data %>%
group_by_(.dots = dots ) %>%
summarize(freq=sum(freq)) %>%
@sdtaylor
sdtaylor / swap_lines.sh
Created December 29, 2016 15:25
Linux swap file stuff
#Create a new file
sudo fallocate -l 4G /swapfile
#RW for root only
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
#check swap
@sdtaylor
sdtaylor / install_old_packages.R
Last active April 24, 2017 22:29
Install all the packages that were in the prior version of R
prior_version = 3.3
library_path = .libPaths()[1]
library_path = substr(library_path, 1, nchar(library_path)-3)
old_library_path=paste0(library_path, prior_version)
old_packages = list.files(old_library_path)
install.packages(old_packages)