Instantly share code, notes, and snippets.

# David Bapst dwbapst

• College Station, TX
Last active June 29, 2021 19:00
Calculating The Chances for Catching Perfect IV Pokemon in Pokemon GO using Brute Force Simulations of Catching and Purification of Shadow Pokemonn
``````nruns <- 1000000 # one million runs
``````

# probability of getting a perfect wild pokemon without weather boosting

``````minIV <- 0
maxIV <- 15

perfects <- 0
for(i in 1:nruns){
``````

pokemon <- sample(x = minIV:maxIV, size = 3, replace = TRUE)

Last active September 29, 2020 15:29
MEE Blog Post for Bapst 2012 paleotree

# `paleotree` in Methods in Ecology and Evolution: A Retrospective

David Bapst

Texas A&M University

dwbapst@tamu.edu

## How I Ended Up Writing About My R Package in Methods in Ecology and Evolution Back In 2012

Last active September 22, 2020 12:52
Programming and How To Use Code from Other People in Your Code

# Programming and How To Use Code from Other People in Your Code

In programming, we often "borrow, reuse or steal" other people's code. This can make the line between what is plagiarized work and what is original work unclear. So, let's dive in a little to how code is reused, and what proper reuse and attribution look like.

## Essentially, All Programming is Borrowing

First, all programming depends on previous programming: the code you will be write in this class (and pretty much any other data science class) relies on a language (R, Python, Java, etc) with a wide number of commands, and the commands available in the languages are what make the language useful. (In R, and many other languages, we refer to 'functions', not commands.) Those 'functions' themselves are pre-packaged segments of code that we can call upon by simply uttering the necessary command -- and they were written by previous developers. So, anyone who develops using such programming languages automatically relies on other people's work

Created December 16, 2019 21:23
trying to make a persistent rb 12-16-19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # persistent_rb_eng_via_nohup.R # to initiate rb: mkfifo in_revbayes # nohup rb out.txt & # to run a sample of code (here 'x = 3+111') # (echo -e "x = 3+111\n" && cat) > in_revbayes &
Last active October 3, 2019 13:08
Pokemon GO nest migration table - oddish removed, with gen 5 and no Eevee - 10-03-19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # Pokemon GO nest migration table - oddish removed, with gen 5 and no Eevee - 10-03-19 # taxa in full nesting list not in NEW nesting list removeTaxaNew <- c("Oddish", "Eevee") # taxa in full nesting list not in OLD nesting list # this is often an empty set because # the nesting list was fully utilized before an event # if full list before migration, just do `""`
Created July 1, 2019 20:19
Phoebe Cohen's Playlist, Coverted to Plaintext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
I Gotta Feeling The Black Eyed Peas THE E.N.D. (THE ENERGY NEVER DIES) 4:49 Party Rock Anthem LMFAO, Lauren Bennett, GoonRock Sorry For Party Rocking 4:22 On The Floor - Radio Edit Jennifer Lopez, Pitbull On The Floor 3:50 Good Feeling Flo Rida Wild Ones 4:08 Just Dance Lady Gaga, Colby O'Donis The Fame Monster (Deluxe) 4:01 TiK ToK Kesha Animal (Expanded Edition) 3:19 Hey Ya! OutKast Speakerboxxx/The Love Below 3:55 Dancing On My Own - Radio Edit Robyn Body Talk 4:38 Call Your Girlfriend Robyn Body Talk 3:47 Run the World (Girls) Beyoncé 4 3:56
Last active February 25, 2024 18:20
Plotting a cool Rotatable 3D Bathymetric + Elevation Cube Using rayshader and marmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 ## To install the latest version from Github: # install.packages("devtools") # devtools::install_github("tylermorganwall/rayshader") ## also marmap # install.packages("marmap") ## load these libraries (?) # library(rayshader) # library(marmap) ## now just imported...
Created May 7, 2019 14:01
Nest Migration Script 05-06-19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 filename <- "remove_pika_aipom" # remove taxa removeTaxa <- c("Pikachu", "Aipom") #################################### ###################################
Created April 22, 2019 18:52
Script from Armin showing that "terminal branches" are being included in dating of trees
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 library(paleotree) #Simulate some fossil ranges with simFossilRecord set.seed(444) record<-simFossilRecord(p=0.1, q=0.1, nruns=1, nTotalTaxa=c(30,40), nExtant=0) taxa<-fossilRecord2fossilTaxa(record) #simulate a fossil record with imperfect sampling with sampleRanges rangesCont <- sampleRanges(taxa,r=0.5)
Last active March 15, 2019 21:42
Code for Plotting a Nice 78-Taxon Phylogeny with Stratigraphic Ranges, Upward Orientation, Phylopics, White Foreground Color with Black Background, etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 devtools::install_github("dwbapst/paleotree", ref="dev_refinedphylopicfun") library(paleotree) taxaSeventyEight <- c( "Archaeopteryx", "Pinus", "Procoptodon", "Olenellus", "Eldredgeops", "Quetzalcoatlus", "Homo", "Tyrannosaurus", "Triceratops", "Giraffa", "Bolivina", "Cancer", "Dicellograptus", "Dunkleosteus", "Solanum", "Anomalocaris", "Climacograptus", "Halysites", "Cyrtograptus", "Procoptodon", "Megacerops", "Moropus", "Dimetrodon", "Lingula",