title: R plot_ly Error: Column `x` must be length 1 or 4, not 2
body: <p>for this i Error: Column <code>x</code> must be length 1 or 4, not 2</p>
  
  <pre><code>library(plotly)
  library(RColorBrewer)
  coul = brewer.pal(4, "BuPu") 
  Vertrag &lt;- read.table(text =
  '"Vert","Start","Ende"
  "1","01.07.2017","31.03.2018"
  "1","31.03.2018","30.06.2018"
  "1","01.07.2018","31.03.2019"
  "1","31.03.2019","30.06.2019"',
  sep=',',header =T )
  Vertrag$Start &lt;- as.Date(Vertrag$Start, format ="%d.%m.%Y")
  Vertrag$Ende &lt;- as.Date(Vertrag$Ende, format ="%d.%m.%Y")
  p &lt;- plot_ly()
  for(i in 1:(nrow(Vertrag))){
    p &lt;- add_trace(p,
                   x = c(Vertrag$Start[i],Vertrag$Start[i] + difftime(Vertrag$Ende[i],Vertrag$Start[i], units = "days")),
               y = c(Vertrag$Vert),
               mode = "lines",
               line = list(color = colorRampPalette(coul)(10),width = 20))
  }
  p
  </code></pre>
  
  <p>But when "Vertrag" have only two rows it works. </p>
  
  <p>Any idea why and whats wrong?</p>
  
  <p>Thanks </p>
  
  <p>Olaf</p>