Description Usage Arguments Details Value Author(s) Examples
View source: R/plot_all_nlsLoop.R
creates a pdf of all models fitted with nlsLoop.
1 2 |
file_name |
the desired path for the pdf to be saved to. |
data |
the data frame containing the data used in the nlsLoop argument |
param_data |
the nlsLoop object |
id_col |
an optional argument if a different column is desired from which each new plot panel is chosen |
col_point |
optional argument to control colour of points |
col_line |
optional argument to control colour of predictions |
group |
optional argument to ensure lines are grouped properly |
... |
extra arguments to feed into |
Creates a pdf where each new page is a graph of one level of id_col
with raw data and corresponding predictions.
a plot using ggplot2 of the points and predictions of a single level of id_col
Daniel Padfield
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # load in data
data("Chlorella_TRC")
Chlorella_TRC_test <- Chlorella_TRC[Chlorella_TRC$curve_id %in% c(1:10),]
# run nlsLoop()
# define the Sharpe-Schoolfield equation
schoolfield_high <- function(lnc, E, Eh, Th, temp, Tc) {
Tc <- 273.15 + Tc
k <- 8.62e-5
boltzmann.term <- lnc + log(exp(E/k*(1/Tc - 1/temp)))
inactivation.term <- log(1/(1 + exp(Eh/k*(1/Th - 1/temp))))
return(boltzmann.term + inactivation.term)
}
fits <- nlsLoop(ln.rate ~ schoolfield_high(lnc, E, Eh, Th, temp = K, Tc = 20),
data = Chlorella_TRC_test,
tries = 500,
id_col = 'curve_id',
param_bds = c(-10, 10, 0.1, 2, 0.5, 5, 285, 330),
lower = c(lnc=-10, E=0, Eh=0, Th=0))
## Not run:
plot_all_nlsLoop('WhereYouWillSaveTheFile.pdf', data = Chlorella_TRC_test, param_data = fits)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.