title: How to add geom_line to stacked barplot in r
body: <p>Below is my code. I am tried to add one line (data from a different csv file) on top of a stacked barplot however it wont work, the error says "object variable not found". Without added the geom_line the stacked barplot works so I assume it is the line that is creating the issue. Any ideas on how I fix this?</p>
  
  <pre><code>a &lt;- read.csv("data.csv", header=TRUE, sep=",")
  
  line1 &lt;- read.csv("data1.csv", header=TRUE, sep=",")
  
  line2 &lt;- data.frame(line1)
  
  library(reshape2)
  c &lt;- melt(a, id.var="day")
  
  library(ggplot2)
  a &lt;- ggplot(c, aes(x=day, y=value, fill=variable)) +
  
   geom_bar(stat="identity", aes(x=day, y=value), width=0.7) +
  
   geom_line(data=line2, aes(x=day, y=value), color="black", stat="identity") 
   +
  
   scale_fill_manual(values = c("black", "grey47", "grey")) +
  
   scale_x_continuous(breaks = round(seq(min(m$day), max(m$day), by = 1),0))
  
   print(a)
  </code></pre>