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.
| 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) |
| #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 |
| #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)) %>% |
| 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),] |
| > 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)) |
Here is the projection for these shapefiles in a proj4string format, as defined in https://www.fs.fed.us/nrs/atlas/littlefia/albers_prj.txt
'+proj=aea +lat_1=38 +lat_2=42 +lat_0=40 +lon_0=-82 +x_0=0 +y_0=0 +ellps=clrk66 +units=m +no_defs'
| library(lubridate) | |
| library(dplyr) | |
| #################################################################################### | |
| #' Download downscaled climate forecast data | |
| #' | |
| #' Individual climate models available are are c('CFSv2','CMC1','CMC2','GFDL-FLOR','GFDL','NASA','NCAR'), | |
| #' 'ENSMEAN' is the mean of all models. | |
| #' lead_time is the months into the future to obtain forecasts. Max of 7 | |
| #' Default lat and lon are for Portal, AZ |
| library(tidyverse) | |
| library(cowplot) | |
| ######################### | |
| # Get data | |
| zipped_files = c("1997_daily.csv.zip", "1998_daily.csv.zip", "1999_daily.csv.zip", "2000_daily.csv.zip", "2001_daily.csv.zip", "2002_daily.csv.zip", | |
| "2003_daily.csv.zip", "2004_daily.csv.zip", "2005_daily.csv.zip", "2006_daily.csv.zip", "2007_daily.csv.zip", "2008_daily.csv.zip", | |
| "2009_daily.csv.zip", "2010_daily.csv.zip", "2011_daily.csv.zip", "2012_daily.csv.zip", "2013_daily.zip", "2014_daily.zip", | |
| "2015_daily.zip", "2016_daily.zip", "2017_daily.zip", "2018_daily.zip","2019_daily.zip","2020_daily.zip") | |
| data_folder = 'fawn_data/' |