I'm having issues generating my bar chart and am not sure what the issue might be, any help on this would be greatly appreciated. Please see code and myData below:
#install.packages("readxl")
#install.packages("tidyverse")
#install.packages("ggplot2")
library(readxl)
library(tidyverse)
library(ggplot2)
url <-'https://static-content.springer.com/esm/art%3A10.1038%2Fs41467-022-33628-8/MediaObjects/41467_2022_33628_MOESM16_ESM.xlsx'
#create a dataframe from the Excel data
temp <-tempfile()
download.file(url, temp, mode='wb')
myData <- read_excel(path = temp, sheet = "Fig_1b")
myData %>%
#select the rows and columns that are needed, 3 to 6 and 8
select(c(19:20)) %>%
slice(2:11) %>%
rename(Median = ...20,
Heart = Subgroup 7 "Heart") %>%
mutate(across(c(2), as.numeric))
Everything seems to work fine up until this point.
ggplot(aes(x=Median,y=Heart, color=Sample, fill=Sample, width=0.65)) +
stat_summary(fun.data = mean_se, geom = "bar", lwd=1)