Accelerated development

Imperative { .smaller }

```{R, eval = FALSE} library(lme4)

d <- read.csv("my.file.csv")

...

...

o1 <- lmer(d$d1 ~ d$d2 + (1|d$d3))

...

...

plot(d$d2, d$d1)

## Named { .smaller }

```{R, eval = FALSE}
library(lme4)

flu.data <- read.csv("my.file.csv")
#...
#...
res <- lmer(antigenic.distance ~ num.mutation + (1 | date), data = flu.data)
#...
#...
plot(antigenic.distance ~ num.mutation, data = flu.data)

Commented { .smaller }

```{R, eval = FALSE} library(lme4)

flu.data <- read.csv("my.file.csv")

Some light processing to get data into correct format

...

...

Now the analyses – a linear mixed effect model

res <- lmer(antigenic.distance ~ num.mutation + (1 | date), data = flu.data)

Checking the model is a good one

...

...

Phew, it is, so plot the best explanatory and response variables!

plot(antigenic.distance ~ num.mutation, data = flu.data)

## Structured { .smaller }

```{R, eval = FALSE}
library(lme4)

### <b>
# Function to load in data from file and process
read_flu_data <- function(filename) {
  #' Load in data from file and process

  data <- read.csv(filename)
  # Some light processing to get into correct format
  #...
  data
}
### </b>

flu.data <- read_flu_data("my.file.csv")
# Now the analyses  a linear mixed effect model
res <- lmer(antigenic.distance ~ num.mutation + (1 | date), data = flu.data)
# Checking the model is a good one
#...
#...
# Phew, it is, so plot the best explanatory and response variables!
plot(antigenic.distance ~ num.mutation, data = flu.data)

More structured { .smaller }

helper.R ```{R, eval = FALSE} # All of the helper functions for our # experiments library(lme4) ### read_flu_data <- function(filename) { # Load data and process it data <- read.csv(filename) # Wrangle data #... data } ### ### check_flu_model <- function(model.out) { # Check model is.good.model <- #... #... is.good.model } ### wzxhzdk:2


IBAHCM/RPiR documentation built on Jan. 12, 2023, 7:41 p.m.