I have this piece of R
code that should plot some data growth_data.txt. Basically, it should plot a line graph showing a single line (or line + points) for the control and treated animals in this dataset. That is, one line for all the controls and one line for all the treated animals. Add appropriate error bars for each time point. But I don't know why the plot doesn't show the line and error bars on the plot which is weird.
What is wrong in my code? How to fix it? I included the plot I'm getting now.
library(tximport)
library(DESeq2)
library(tidyverse)
library(cowplot)
library(pheatmap)
library(RColorBrewer)
library(dplyr)
library(ggplot2)
theme_set(theme_classic())
growth_data <- read.delim ("growth_data.txt") %>% tibble()
#tidying the data.
growth_data_long <- growth_data %>% pivot_longer(-animal,
names_to=("Day"),
values_to=("Growth"))
growth2 <- growth_data_long %>%
mutate(group = str_extract(animal, "\\w+"))
growth2
growth2 %>% filter(group!= "") %>% ggplot() + aes(Day, Growth, color=group) + geom_point() + geom_smooth(method = lm)