This function is expected to work with getable's R Markdown template, which contains an .html file, a .js file, and a .css file in addition to the .Rmd source file. The function creates an HTML string and insert it into the HTML file rendered from Rmd. The code in the .js file then process the HTML string and retrieve data from web to create an HTML table dynamically when users view the rendered HTML file in the browser (a server is needed to served the file).

renderTable(url = "./data/df.csv", isjson = FALSE)

Arguments

url

A string. The URL to the source data of the table to be created. Could be a relative path (relative to the .Rmd src file) or an URL to a JSON or CSV file. url could also be an URL to a publicly viewable Google Spreadsheet. Defaults to ./data/df.csv (see the template's structure).

isjson

Boolean. Whether the format of the self-hosted file is json. Defaults to FALSE. Works only when the data is self-hosted (i.e. not from Google Spreadsheet).

Value

A string representing an HTML div tag.

Examples

renderTable("https://raw.githubusercontent.com/liao961120/getable/master/docs/demo/data/df.csv")
#> [1] "<div id=\"data-from-web-2\" data-url=\"https://raw.githubusercontent.com/liao961120/getable/master/docs/demo/data/df.csv\" class=\"data-from-web-csv df-from-web\"></div>" #> attr(,"class") #> [1] "getable.html.tag"