How to run native JavaScript function in R?
<p>I have a native JavaScript function mentioned below which i want to run in R. </p>

<p>JavaScript function:</p>

<pre><code>  $('.btn')
.click(function () {
        var from = parseInt($('.from')[0].value)
            , to = parseInt($('.to')[0].value)
            , newData = [];
        if (!isNaN(from) &amp;&amp; !isNaN(to)) {
            Highcharts.each(data, function (p) {
                if (p.value &gt;= from &amp;&amp; p.value &lt;= to) {
                    newData.push(p);
                }
            });

            }
          })
</code></pre>

<p>I want to bind this function in my Main R script where i am creating High chart Treemap function using shiny. </p>

<p>Main R Highchart Treemap function:</p>

<pre><code>hc&lt;-highchart() %&gt;% 

    hc_title(text = "Costcenter Deviation between Quarters (A-B)") %&gt;%
    #hc_subtitle(text="Q1 and Q2 is default selection")%&gt;%
    hc_colorAxis( stops = colstops, endOnTick=FALSE,startOnTick=FALSE)  %&gt;%
     #hc_colorAxis( minColor = '#1a9641', maxColor= '#a6d96a')  %&gt;%
    hc_add_series(
      type = "treemap",
      layoutAlgorithm = "squarified",
      allowDrillToNode = T,
      dataLabels= list(enabled= F), levelIsConstant= F,


      levels =list( 
        list(
          level = 1,
          dataLabels = list(
            enabled = TRUE
          ),
          borderWidth = 3, borderColor= 'black'

        )
      ),

      data= list_data
    ) %&gt;% 
    hc_tooltip(pointFormat = "&lt;b&gt;{point.name}&lt;/b&gt;
               &lt;br&gt;EUR: {point.actualvalue:,.2f}&lt;/br&gt; &lt;br&gt; Change:{point.change}% &lt;/br&gt;",borderWidth=1, shared= F, followPointer=F , enabled=T, borderRadius=5) %&gt;%
    hc_plotOptions(borderWidth=15,borderColor='#fdae61', animationLimit=1000,turboThreshold=5000)

  hc
</code></pre>

<p>SO, Is there any possible way to achieve this? </p>