[R] Unable to make plots using ggplot2

pooja sinha pj@|nh@07 @end|ng |rom gm@||@com
Sun Feb 16 23:01:14 CET 2020


Hi All,

I have data in excel with the following details:
CHG_methylation Young_Control Young_Treated
0-10% 95.23 94.53
10-20% 3.71 4.16
20-30% 0.68 0.8
30-40% 0.18 0.22
40-50% 0.07 0.09
50-60% 0.04 0.06
60-70% 0.02 0.04
70-80% 0.02 0.03
80-90% 0.02 0.03
90-100% 0.04 0.05
I am trying to plot the graph using ggplot2 but not successful yet. My code
is below:

library(readxl)
library(dplyr)
library(tidyverse)
data2 <- read_excel("CHG_meth_plot1.xlsx")
df <- data2
df <- data.frame(var=c("Young_Control", "Young_Treated", "CHG_methylation"))
df

ggplot(data = df, aes(x = var, y = CHG_methylation)) +
  geom_bar(aes(fill = CHG_methylation))

I am getting error as something is wrong with my df. Also I needed to
create breaks in y-axis as I do not know whether it is possible in R or
not.
Any kind of help is highly appreciated.

Thanks,
Puja

	[[alternative HTML version deleted]]



More information about the R-help mailing list