Skip to content

Instantly share code, notes, and snippets.

View dlebauer's full-sized avatar
😀

David LeBauer dlebauer

😀
View GitHub Profile
library(tidyverse)
library(wesanderson)
library(cowplot)
library(lubridate)
allfields <- read_csv('~/Downloads/canopycover_ratiomask.csv') %>%
mutate(method = 'French')
field3 <- read_csv('~/Downloads/canopycover_ratiomask_field3.csv') %>%
mutate(method = 'French')
all_tr <- read_csv('~/Downloads/allcanopycover (1).csv') %>% select(-X1) %>%
mutate(method = 'Li')
---
title: "Meta analysis plot organization"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Lets look at what MA outputs look like
# from https://pygame-zero.readthedocs.io/en/stable/introduction.html
import pgzrun
#import random
WIDTH = 500
HEIGHT = 1000
alien = Actor('alien')
alien.pos = WIDTH/2, HEIGHT/2
Formula What It Accounts for Limitations How to Use it Misc. Citation(s)
@dlebauer
dlebauer / PI_cultivars.txt
Created July 3, 2020 01:39
renaming cultivars so that they follow the PIXYZ convention rather thant PI_XYZ see https://github.com/terraref/data-paper/issues/24
6000001885 PI_598070
6000001886 PI_533997
6000001887 PI_597946
6000001888 PI_533937
6000001889 PI_655984
6000001890 PI_659695
6000001891 PI_656058
6000001892 PI_533769
6000001893 PI_576364
6000001894 PI_533750
@dlebauer
dlebauer / fix_season4_treatments.sql
Created July 1, 2020 23:21
spent a long time messing w/ regex before doing it the 'easy' way
select treatments.name, count ( * ) as n
from treatments join traits on treatments.id = traits.treatment_id
where
extract ( year from date ) = 2017
and extract ( month from date ) between 4 and 10
and checked > - 1
group by treatments.name;
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"license": "https://spdx.org/licenses/BSD-3-Clause",
"codeRepository": "git+https://github.com/agpipeline/greenness-transformer",
"contIntegration": "git+https://github.com/agpipeline/greenness-transformer",
"dateCreated": "2020-05-22",
"datePublished": "0000-00-00",
"dateModified": "2020-05-22",
"downloadUrl": "https://github.com/AgPipeline/greenness-transformer/archive/master.zip",
@dlebauer
dlebauer / pecan64.ed.xml
Last active May 14, 2020 16:48
debugging workflow.R
<?xml version="1.0"?>
<pecan>
<outdir>pecan</outdir>
<database>
<bety>
<driver>PostgreSQL</driver>
<user>bety</user>
<password>bety</password>
<host>postgres</host>
@dlebauer
dlebauer / terraref_eml.R
Last active May 6, 2020 18:16
BETYdb --> EML first draft example with terraref eml metadata
# Code used to generate metadata/eml_metadata.xml
library(EML)
dsl <- eml$creator(individualName = eml$individualName(givenName = "David",
surName = "LeBauer"),
organizationName = "University of Arizona",
electronicMailAddress = "dlebauer@arizona.edu",
userId = list(directory = "https://orcid.org",
userId = "https://orcid.org/0000-0001-7228-053X"))
doc <- list(packageId = "dataset-1", system = "Dryad",
@dlebauer
dlebauer / periodicity_modulo.R
Last active May 1, 2020 23:56
Exercise from math circle
# https://stats.stackexchange.com/a/1214/1381
find.freq <- function(x)
{
n <- length(x)
spec <- spec.ar(c(x),plot=FALSE)
if(max(spec$spec)>10) # Arbitrary threshold chosen by trial and error.
{
period <- round(1/spec$freq[which.max(spec$spec)])
if(period==Inf) # Find next local maximum