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
# load in packages | |
library(dplyr) | |
# create two random dataframes | |
random <- data.frame(y = rnorm(30, 10), x = rnorm(30, 100), z = rnorm(30, -15)) | |
fixed <- data.frame(y = rnorm(30, 10), x = rnorm(30, 10), z = rnorm(30, 10), a = rnorm(30, 10)) | |
# find columns to change the values of | |
cols_change <- colnames(fixed)[colnames(fixed) %in% colnames(random)] |
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
# testing non-linear regression methods | |
# devtools::install_github('padpadpadpad/nlsLoop') | |
library(nlsLoop) | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(brms) | |
library(ggridges) |
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
## ---- setup, echo = FALSE------------------------------------------------ | |
knitr::opts_knit$set(root.dir = normalizePath('../..')) | |
## ---- load_packages, message = FALSE, warning = FALSE-------------------- | |
# load packages into R | |
library(rBLAST) | |
library(taxize) | |
library(dplyr) | |
library(tidyr) | |
library(purrr) |
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
# load packages | |
library(dplyr) | |
library(tidyr) | |
# get today's date and base url in the dataframe | |
dat <- data.frame(date = as.character(Sys.Date()), | |
url = 'https://crosswords-static.guim.co.uk/gdn.quick.pdf') | |
# replace '-' with '' | |
dat <- mutate(dat, date = gsub('-', '', date)) |
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
# testing ips | |
library(ips) | |
library(phyloseq) | |
# load in example data | |
data(ips.cox1) | |
data(ips.16S) | |
data(ips.28S) | |
ips <- cbind(ips.cox1, ips.16S, ips.28S, |
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
# phylogenetic tree options | |
# using fasttree | |
# load packages | |
library(phyloseq) | |
library(tidyr) | |
library(dplyr) | |
library(dada2) | |
# NEED TO INSTALL FASTTREE |
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
# Mothur PCoA Dirk sequencing | |
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
# replace metadata with new metadata | |
meta_new <- read.csv('~/Desktop/Work/dirk_sequencing/data/metadata.csv', stringsAsFactors = FALSE) %>% | |
mutate(., time = as.character(time)) |
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
# quick bootstrap of a TPC model | |
# load packages | |
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
library(nls.multstart) # devtools::install_github('padpadpadpad/nls.multstart') | |
library(broom) | |
library(purrr) | |
library(patchwork) # devtools::install_github('thomasp85/patchwork') |
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
# Get league tables from engsoccerdata | |
# Daniel Padfield | |
# load in packages | |
library(engsoccerdata) | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
# load in data |
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(ggplot2) | |
d <- data.frame(x = rnorm(20), y = rnorm(20)) | |
d$row <- paste('C', row.names(d), sep = '_') | |
# random plot | |
ggplot(d, aes(row, y)) + | |
geom_point() | |
# order by y, highest first |