title: dim(X) must have a positive length
body: <p>I am trying to call a Azure Machine Learning web service from Microsoft Power BI (Visualization tool) through R. The process demands input to be given as a list. So for that I am converting my input to a list in R. Below is my code.</p>
  
  <pre><code>dataset &lt;- data.frame(sqlQuery(conn, "SELECT * FROM dbo.Automobile")) 
  close(conn)
  
  if(nrow(dataset)&gt;0)
  {
  dataset &lt;- dataset[,c(-1, -14)]
  dataset &lt;- na.omit(dataset)
  
  createList &lt;- function(dataset)
  {
    temp &lt;- apply(dataset, 1, function(x) as.vector(paste(x, sep = "")))
    colnames(temp) &lt;- NULL
    temp &lt;- apply(temp, 2, function(x) as.list(x))
    return(temp)
  }
  ...
  </code></pre>
  
  <p>I am very new to R so above code is from Power BI's documentation only. But  is gives the following error : </p>
  
  <blockquote>
    <p>dim(X) must have a positive length</p>
  </blockquote>
  
  <p>I tried googling this error and applied some of the workarounds like <br>
  1. using lapply function <br>
  2. adding <code>drop=F</code> <br>
  but kept on returning errors.</p>
  
  <p>Can anyone help me with this ? </p>