title: problem with R 'data' must be of a vector type, was 'NULL'
body: <p>I´ve created this function:</p>
  
  <pre><code>vlw=function(x,y)
  {
  for(i in 0:20){
  if((i&gt;=1)&amp;(i&lt;=4)|(i&gt;=6)&amp;(i&lt;=9)|(i&gt;=11)&amp;(i&lt;=14)|(i&gt;=16)&amp;(i&lt;=19))
  {
    next()
  }
  print(ifelse((x&lt;i)&amp;(y&lt;i)|(x&gt;(i+5))&amp;(y&gt;(i+5)),0,ifelse((x&lt;i)&amp;(y&lt;(i+5)),(y-i)/5,ifelse((x&lt;(i+5))&amp;(y&gt;(i+5)),(i+5-x)/5,ifelse((x&gt;i)&amp;(y&lt;(i+5)),(y-x)/5,1)))))
    }
  }
  </code></pre>
  
  <p>If I I use this imputs:</p>
  
  <pre><code>iv=c(-1,-2,4,9,10,5,-1)
  fv=c(3,-1,6,10,11,10,8)
  </code></pre>
  
  <p>my result is:</p>
  
  <pre><code>[1] 0.6 0.0 0.2 0.0 0.0 1.0 1.2
  [1] 0.0 0.0 0.2 1.0 1.0 1.0 0.6
  [1] 0 0 0 0 1 0 0
  [1] 0 0 0 0 0 0 0
  [1] 0 0 0 0 0 0 0
  </code></pre>
  
  <p>The problem is that I would like to creat a matrix from this result, but when I put:</p>
  
  <pre><code>exp4=as.matrix(vlw(iv,fv),5,7)
  </code></pre>
  
  <p>I read this error:</p>
  
  <p>Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
    'data' must be of a vector type, was 'NULL</p>
  
  <p>Do you know how can I solve it?</p>