This file contains hidden or 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
#' Write out a geography file in PHYLIP format for BioGeoBears | |
#' | |
#' @param data Dataframe; species distributions in regions, with one row per | |
#' region per species. Must have columns 'species' and 'region' | |
#' @param output_file Path to write outputfile | |
#' | |
#' @author Joel Nitta | |
#' | |
#' @return The the path to `output_file`. | |
#' |
This file contains hidden or 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(tidyverse) | |
dat <- tibble(var = c("a_b", "c_d")) | |
split_vec_to_df <- function(x) { | |
tibble( | |
var_1 = str_split(x, "_")[[1]][[1]], | |
var_2 = str_split(x, "_")[[1]][[2]] | |
) | |
} |
This file contains hidden or 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(tidyverse) | |
path_to_csv_file <- "change/this/to/the/path/on/your/machine.csv" | |
# Load the participants responses | |
# The `#` column has a unique ID for each answer, but this is not the same | |
# as the user-entered unique ID (those are unfortunately NA in some cases as the | |
# participant didn't answer that question) | |
partic <- read_csv(path_to_csv_file) %>% | |
rename(num = `#`) |
This file contains hidden or 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
# Filter a list of references in YAML format to those cited in an RMD file | |
# | |
# The YAML list should be exported from Zotero | |
# like this: file -> "export library" -> "Better CSL YAML" | |
# | |
# Exporting YAML from Zotero requires the Better Bibtex for Zotero extension | |
# to be installed https://retorque.re/zotero-better-bibtex/ | |
library(tidyverse) | |
library(yaml) |
This file contains hidden or 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
#' force_ultrametric | |
#' | |
#' Force the branch lengths of a tree to be ultrametric. Most useful in cases | |
#' when a time-tree is imported into R but the branch lengths are not exactly | |
#' ultrametric due to rounding error. Uses a different (faster) method from | |
#' phytools::force.ultrametric() | |
#' | |
#' @param tree Input tree; list of class "phylo". Should already be ultrametric | |
#' within rounding error. | |
#' @param force.positive Logical; should the branch lengths be forced to be |
This file contains hidden or 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
--- | |
title: "`posterdown`: Generate Reproducible & Live HTML and PDF Conference Posters Using RMarkdown" | |
author: | |
- name: Brent Thorne | |
affil: 1 | |
orcid: '0000-0002-1099-3857' | |
- name: Another G. Author | |
affil: 2 | |
affiliation: | |
- num: 1 |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?><beast beautitemplate='Standard' beautistatus='' namespace="beast.core:beast.evolution.alignment:beast.evolution.tree.coalescent:beast.core.util:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel:beast.evolution.substitutionmodel:beast.evolution.likelihood" required="" version="2.6"> | |
<data | |
id="primates" | |
spec="Alignment" | |
name="alignment"> | |
<sequence id="seq_Gorilla" spec="Sequence" taxon="Gorilla" totalcount="4" value="AAGCTTCACCGGCGCAGTTGTTCTTATAATTGCCCACGGACTTACATCATCATTATTATTCTGCCTAGCAAACTCAAACTACGAACGAACCCACAGCCGCATCATAATTCTCTCTCAAGGACTCCAAACCCTACTCCCACTAATAGCCCTTTGATGACTTCTGGCAAGCCTCGCCAACCTCGCCTTACCCCCCACCATTAACCTACTAGGAGAGCTCTCCGTACTAGTAACCACATTCTCCTGATCAAACACCACCCTTTTACTTACAGGATCTAACATACTAATTACAGCCCTGTACTCCCTTTATATATTTACCACAACACAATGAGGCCCACTCACACACCACATCACCAACATAAAACCCTCATTTACACGAGAAAACATCCTCATATTCATGCACCTATCCCCCATCCTCCTCCTATCCCTCAACCCCGATATTATCACCGGGTTCACCTCCTGTAAATATAGTTTAACCAAAACATCAGATTGTGAATCTGATAAC |
This file contains hidden or 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(tidyverse) | |
# Specify directory with files to get checksums | |
dir <- "my_folder" | |
# Get checksums | |
list.files(dir, full.names = TRUE) %>% | |
tools::md5sum() %>% | |
tibble(file = names(.), checksum = .) %>% | |
filter(!is.na(checksum)) %>% |
This file contains hidden or 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
# This function can be called inside of other functions to check | |
# if the names of the input match the names of the arguments | |
check_args <- function(call_match) { | |
call_names <- as.character(call_match) | |
arg_names <- names(as.list(call_match)) | |
stopifnot( | |
"Names of input must match names of arguments" = isTRUE(all.equal(call_names[-1], arg_names[-1])) | |
) | |
} |
This file contains hidden or 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
taxonID | datasetID | datasetName | acceptedNameUsageID | parentNameUsageID | taxonomicStatus | taxonRank | verbatimTaxonRank | scientificName | kingdom | phylum | class | order | family | genericName | genus | subgenus | specificEpithet | infraspecificEpithet | scientificNameAuthorship | namePublishedIn | nameAccordingTo | modified | taxonConceptID | scientificNameID | references | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
54115096 | 140 | World Ferns in Species 2000 & ITIS Catalogue of Life: 2019 | NA | 54830341 | accepted name | species | NA | Cephalomanes atrovirens Presl | Plantae | Tracheophyta | Polypodiopsida | Hymenophyllales | Hymenophyllaceae | Cephalomanes | Cephalomanes | NA | atrovirens | NA | Presl | NA | Hassler M. | Nov 2018 | NA | ferns-1911-colgen | http://www.catalogueoflife.org/col/details/species/id/f5950556e578afe0332ef6a18360dd97 | |
54133783 | 140 | World Ferns in Species 2000 & ITIS Catalogue of Life: 2019 | 54115097 | NA | synonym | species | NA | Trichomanes crassum Copel. | Plantae | NA | NA | NA | NA | Trichomanes | Cephalomanes | NA | crassum | NA | Copel. | NA | NA | NA | NA | ferns-1915-syn-1 | http://www.catalogueoflife.org/col/details/species/id/bb5e2f017639f8fb9de177c |