Hao Ye Health Science Center Libraries, University of Florida (updated: 2021-01-28)
Good programmers write code that humans can understand."
from "Refactoring: Improving the Design of Existing Code" by Martin Fowler
R
.r
mean()
# computes arithmetic mean of input
r
celsius_to_fahrenheit <- function(x) {
9/5 * x + 32
}
r
data_raw <- readRDS("readings.dat")
data_proc <- preprocess_data(data_raw)
fitted_model <- run_model(data_proc)
plot_model_forecasts(fitted_model,
"figure-1_abundance-forecasts.pdf")
plot_abundance_residuals(fitted_model,
"figure-2_abundance-residuals.pdf")
plot_abundance_histogram(data_proc,
"figure-3_abundance-residuals.pdf")
data_proc
and fitted_model
objects to a file. Then figure code can be changed without re-running the model.r
plot_abundance_histogram <-
function(data_proc, filename,
width = 6, height = 6) {
# {{code}}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.