title: function that returns nothing in void call
body: <p>I confused when I created the following simple function. 
  If I do not assign the class in the temp then I see nothing on the screen when I execute the function (without print or assigning to anything)</p>
  
  <pre><code>library(dplyr)
  library(data.table)
      my_percentage &lt;- function(datatable, variable ){ 
              temp &lt;- datatable[, .N, keyby = c(variable)]
              temp[, percentage := N/sum(N)]
               # temp &lt;- as.data.table(temp)
              return(temp)
      }
  
  my_percentage(iris %&gt;% as.data.table(), variable = "Species")
  # print(my_percentage(iris %&gt;% as.data.table(), variable = "Species"))
  </code></pre>
  
  <p>However if I assign any class in the object that I will return it will be fine.</p>
  
  <pre><code>my_percentage &lt;- function(datatable, variable ){ 
              temp &lt;- datatable[, .N, keyby = c(variable)]
              temp[, percentage := N/sum(N)]
              temp &lt;- as.data.table(temp)
              return(temp)
      }
  
  my_percentage(iris %&gt;% as.data.table(), variable = "Species")
  </code></pre>
  
  <p>Can anyone explain to me why ?</p>