How to embed some R script(R scraping function) in html website to create automatad tables

I want to use some of my R functions in the website i'm creating.
Some of my R functions will scrape data from others website, clean some data and then show the remaining data as table in my website. Others R functions will plot differents graph using the previous data.
So I'm looking to a way to embed my R script in the html website or to convert my R Scripts to JavaScript so that it can be easyly added to my html website.
Is there a R package or function than can help me converting any R function to Javascript function? Any advice about tackling an issue like this is greatly appreciated.

A minimal r function code example :

library(rvest)
library(tidyverse)

BRVM_cap <- function(){
  # company<-toupper(company)
  tryCatch({
    brvm_cap <- rvest::read_html("https://www.brvm.org/en/capitalisations/0/status/200") %>%
      rvest::html_nodes('table') %>%
      rvest::html_table()
    brvm_cap <- brvm_cap[[4]]
    brvm_cap$`Global capitalization (%)`<-gsub(",", ".",brvm_cap$`Global capitalization (%)`)
    brvm_cap <- tibble::as.tibble(brvm_cap)
    return(brvm_cap)

  },
  error = function(e) {
    print("Make sure you have an active internet connection")
  },
  warning = function(w) {
    print("Make sure you have an active internet connection")
  })
}

How can i convert BRVM_cap (R function) to a similar javascript function?
Or how can i embed BRVM_cap script function to the web (the embeded code must be hide to users)?
Thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.