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
# try weighted bootstrapping of many curves | |
# combines approach from weighted bootstrapping and bootstrapping many curves | |
# https://padpadpadpad.github.io/rTPC/articles/bootstrapping_many_curves.html | |
# https://padpadpadpad.github.io/rTPC/articles/weighted_bootstrapping.html | |
# load in packages | |
librarian::shelf(tidyverse, rTPC, nls.multstart, broom, minpack.lm, car) | |
# load in data | |
data("chlorella_tpc") |
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
# example of using cowplot and patchwork to make a plot with legends in the bottom right of a four panel plot | |
# load in packages | |
librarian::shelf(tidyverse, patchwork, cowplot) | |
# make a random plot with colour | |
p1 <- ggplot(mpg, aes(hwy, cty, col = class)) + | |
geom_point() | |
# make other plot with colour on |
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
# random modelling example for Stephen | |
# load in packages | |
librarian::shelf(rTPC,tidyverse, nls.multstart) | |
# create data | |
d <- chlorella_tpc %>% | |
filter(curve_id < 4) %>% | |
nest(data = c(everything(), -curve_id)) |
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
# compare Gompertz model to Logistical growth model | |
# load packages | |
library(tidyverse) #install.packages(tidyverse) | |
library(zoo) #install.packages(zoo) | |
library(broom) #install.packages(broom) | |
library(growthcurver) # install.packages(growthcurver) | |
library(nls.multstart) # install.packages(nls.multstart) | |
# remotes::install_github('padpadpadpad/MicrobioUoE) |
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
# muhisse example | |
# from https://speciationextinction.info/articles/MuHiSSE-vignette.html | |
# load packages | |
library(hisse) | |
library(diversitree) | |
# simulate simple four state model | |
pars <- c(.1, .15, .2, .1, # lambda 1, 2, 3, 4 | |
.03, .045, .06, 0.03, # mu 1, 2, 3, 4 |
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
# example of map2 | |
# load packages | |
library(nls.multstart) | |
library(rTPC) | |
library(tidyverse) | |
# load data and keep only 2 curves | |
data("chlorella_tpc") | |
d <- chlorella_tpc %>% |
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 and dirty example of not italicising the whole label. | |
# Italicise certain words only in facet labels in ggplot2 | |
library(tidyverse) | |
# create random data frame | |
species <- c('Chlorella sp.', 'Buteo buteo') | |
d <- tibble(species = species) %>% | |
group_by(species) %>% |
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
# try and recreate famous Ed Hawkins climate change spiral graphic in R and ggplot2 | |
# load packages | |
library(tidyverse) | |
library(MetBrewer) | |
library(gganimate) | |
# load in dataset from NASA | |
d <- read.csv('https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv', skip = 1) | |
head(d) |
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
# nls.multstart example calculating rsquared and RMSE | |
# load packages | |
library(nls.multstart) | |
library(soilphysics) | |
library(modelr) | |
# load in data | |
data("Chlorella_TRC") |
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(growthcurver) | |
library(tidyverse) | |
# load in example data | |
d <- growthdata # load some sample, simulated data | |
gc_fit <- SummarizeGrowthByPlate(d) # do the analysis | |
plot(gc_fit) # plot your data and the best fit | |
gc_fit$model %>% broom::augment() |