Posts

Showing posts from December, 2024

How to draw a growth curve in R

Image
In a growth curve of a bacteria, we will have the optical density measurements against time. For each time point, we will have a few technical replicates. Let’s take the following data which has time, and replicates A, B, and C. We have saved this table in a excel file. The file is named as growth_curve.xlsx and is stored in a folder/directory called datasets , relative to my current working directory. First thing we would do is load the tidyverse library, which will have the ggplot2 library we will use for plotting the growth curve. library(tidyverse) We will first read the data from excel into tibble and see how it looks like. data <- readxl::read_excel('datasets/growth_curve.xlsx') data Then, we will see the whole code to process and plot the data and later explain it step by step. # calculate mean and standard deviations data <- data %>% rowwise() %>% mutate( means = mean(c(A, B, C)), stdev = sd(c(A, B, C)) ) # plot the means and standar...