I have the following code which seems to work well when I just have it as below

```
      p<-ggplot(data=x.all.ER, aes(x=Year, y=value, fill = (factor(x.all.ER$Strategy))))+ 
      geom_bar(stat = 'identity',position = 'dodge', colour = "black") +
      scale_fill_manual(values = mycols) +
      scale_y_continuous(breaks=  seq(-0.3,0.3,by=0.025), labels = percent) +
      ylab("ERET") + theme(axis.title.y = element_text(size=15, face = "bold"))+
      xlab("YEAR") + theme(axis.title.x = element_text(size=15, face = "bold"))
      print(p)

```

But when I try to wrap this around another function it gives me errors. Any help is greatly appreciated. Thanks!

```
      mybar<-function(DS, x, y, fillby, labels, mycols, xlabel, xbreaks, 
                                                            ylabel, title)
          {
     #my.cols =c("#F7FBFF", "#DEEBF7", "#C6DBEF", "#9ECAE1", "#6BAED6", 
             # "#000000","#2171B5")

      p<-ggplot(data=DS, aes(x=x, y=y, fill = fillby)+ 
              geom_bar(stat = 'identity',position = 'dodge', colour = "black") + 
              scale_fill_manual(values = mycols) +
              scale_y_continuous(breaks=  xbreaks, labels = percent) +
              ylab(ylabel) + 
              theme(axis.title.y = element_text(size=15, face = "bold"))+   
              xlab(xlabel) + 
              theme(axis.title.x = element_text(size=15, face = "bold"))
              print(p)
        }

```