title: R formattable datatable to shiny
body: <p>i have this code that work normally in RStudio
  but i wont this in shiny
  as.datatable() does not work in shiny with renderFormattable</p>
  <p>it says  &quot;no applicable method for 'as.htmlwidget' applied to an object of class &quot;c('datatables', 'htmlwidget')&quot;&quot;</p>
  <h1>server.R</h1>
  <p>output$data&lt;-renderFormattable({</p>
  <pre><code>  df1&lt;-merge(happiness5[,c(1,3)],
               happiness6[,c(1,3)],
               by.x = &quot;Country&quot;,
               by.y = &quot;Country&quot;)
    colnames(df1)&lt;-c(&quot;Country&quot;,&quot;Happiness Rank 2015&quot;,&quot;Happiness Rank 2016&quot;)
    df1&lt;-df1%&gt;%
      mutate(`Rank Change`=`Happiness Rank 2015`-`Happiness Rank 2016`)
    
    
    formattable(df1,list(
      `Rank Change` = formatter(
        &quot;span&quot;,
        style=~formattable::style(color=ifelse(`Rank Change`&gt;0,&quot;green&quot;,&quot;red&quot;)))))%&gt;%
      as.datatable()
  },env = parent.frame(), quoted = FALSE)
  </code></pre>