title: Plotly - Publishing my plot with R
body: <p>I have a Plotly account and an R script creating a plot I want to publish on my Plotly page. After looking at the Plotly Getting Started page and some other online advice, I ended up with this code.</p>
  
  <pre><code>library(XLConnect)
  library(dplyr)
  library(ggplot2)
  library(devtools)
  library(plotly)
  
  ##Preparing the data file
  myurl &lt;-     "http://minagric.gr/images/stories/docs/agrotis/Elia/egekrimenes_typop_monades220715.xls"
  temp &lt;- file.path(getwd(), "temp.xls")
  download.file(myurl,temp)
  mydata &lt;- readWorksheetFromFile(temp, sheet=1, header = TRUE, startRow = 2)
  colnames(mydata)&lt;-c("name", "approval_code", "region", "prefecture")
  
  plot_region &lt;- ggplot(mydata,aes(x=region)) + 
        geom_histogram(fill="lightblue") +
        theme(plot.title = element_text(size=15, face="bold", vjust=2),     axis.text.x=element_text(angle=50, size=5, vjust=0.35)) +
        labs(title = "Olive oil plants per Region") + 
        xlab("Region") + ylab("Number of plants")
  py &lt;- plotly(username = "myusername", key = "mykey")    
  response&lt;-py$ggplotly(plot_region)
  </code></pre>
  
  <p>However, this error presents itself when I execute the code:</p>
  
  <pre><code>Error in eval(expr, envir, enclos) : attempt to apply non-function
  In addition: Warning messages:
  1: 'plotly' is deprecated.
  Use 'ggplotly' instead.
  See help("Deprecated") 
  2: 'plotly' is deprecated.
  Use 'plot_ly' instead.
  See help("Deprecated") 
  </code></pre>
  
  <p>How can I solve this and publish my plots? I have also tried the following:</p>
  
  <pre><code>ggplotly(plot_region)
  </code></pre>
  
  <p>but it presents this error:</p>
  
  <pre><code>Error in `[[&lt;-.data.frame`(`*tmp*`, a, value = c("ΣΤΕΡΕΑ ΕΛΛΑΔΑ",  : 
    replacement has 483 rows, data has 13
  </code></pre>