title: Error in `$<-.data.frame`(x, name, value) : replacement has 1 row, data has 0
body: <p>When running this code</p>
  <pre><code>projectile &lt;- data.table()
  projectile$angle&lt;- c(15, 30, 45, 60, 75)  
  projectile$distance &lt;- c(5.1, 8, 10,  8.5, 4.8)
  ggplot() + geom_point( aes(projectile$angle, projectile$distance)  ) # Works
  ggplot(projectile) + geom_point( aes(angle,distance) ) # Does not work
  </code></pre>
  <p>I get this error:</p>
  <pre><code>Error in `$&lt;-.data.frame`(x, name, value) : 
    replacement has 1 row, data has 0
  
  </code></pre>
  <p>Can anyone explain what this error means, why I have it and how to fix it, please?</p>
  <p>UPDATE:
  the same error occurs at earlier step if I use <code>data.frame</code>:</p>
  <pre><code>projectile &lt;- data.frame()
  projectile$angle&lt;- c(15, 30, 45, 60, 75) 
  </code></pre>
  <p>Error:</p>
  <pre><code>Error in `$&lt;-.data.frame`(`*tmp*`, angle, value = c(15, 30, 45, 60, 75 : 
    replacement has 5 rows, data has 0
  </code></pre>
  <p>The reason why I dont create <code>data.frame(angle=c(..), distance=c(..)</code> right away is obviously that these values are NOT known until the user enters them later.</p>