Title: | 'HTML' Reporting Made Simple(R) |
Version: | 1.0.0 |
Description: | Create compressed, interactive 'HTML' (Hypertext Markup Language) reports with embedded 'Python' code, custom 'JS' ('JavaScript') and 'CSS' (Cascading Style Sheets), and wrappers for 'CanvasXpress' plots, networks and more. Based on https://pypi.org/project/py-report-html/, its sister project. |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Depends: | R (≥ 3.5.0) |
Imports: | methods, mime, ggplot2, knitr, xfun, grDevices, utils, jsonlite |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
URL: | https://github.com/AEstebanMar/htmlreportR |
BugReports: | https://github.com/AEstebanMar/htmlreportR/issues |
NeedsCompilation: | no |
Packaged: | 2024-07-31 10:06:58 UTC; aestebanm |
Author: | Álvaro Esteban Martos
|
Maintainer: | Álvaro Esteban Martos <alvaroesteban@uma.es> |
Repository: | CRAN |
Date/Publication: | 2024-08-19 08:20:06 UTC |
Add Header and Row Names to Data Frame for HTML Report table
Description
This function modifies a data frame to include specific column and row names.
Arguments
data_frame |
The data frame to be modified. |
options |
A list of options controlling the modification of column and row names. |
Details
Add Header and Row Names to Data Frame for HTML Report table
This function checks the options provided and manipulates the column and row names of the input data frame accordingly. If the 'header' option is set to true, it assigns the first row of the data frame as column names and removes that row from the data frame. If the 'row_names' option is true, it assigns the first column of the data frame as row names and removes that column from the data frame. If either option is not true, it assigns sequential numbers as column or row names, respectively.
Value
The modified data frame with updated column and/or row names.
Build CanvasXpress barplot from R data frame
Description
Loads data frame and CanvasXpress options for barplot, then calls canvasXpress_main to build it.
Arguments
options |
list with options. |
Details
CanvasXpress barplot
Value
HTML code for CanvasXpress bar plot of data.
Build HTML report from template
Description
This function builds an HTML report from a given template file for an object of class "htmlReport".
Arguments
template |
A character string specifying the file path of the template. |
Details
Build HTML report from template
This function reads the contents of the template file, sets up Knitr options for rendering, renders the template using Knitr, and constructs the HTML report by combining the rendered template with the existing report content in the "htmlReport" object.
Value
A new instance of the htmlreportR class
Build HTML Report Body
Description
This method builds the body of an HTML report
by appending the specified body text to an htmlReport
object.
Arguments
body_text |
A character string containing the body text to be appended to the HTML report. |
Details
Build HTML Report Body
Value
An updated htmlReport
object with the specified
body text appended to its body.
encode and compress data json
Description
compress_data
Arguments
data |
string indicating object id |
Value
encoded and compressed json
Custom addition operator for combining htmlReport objects
Description
This function defines a custom addition operator for combining two strings.
Arguments
value |
An object of any type that can be coerced to character. |
Details
Custom addition operator for combining htmlReport objects
Value
An object of class "htmlReport" with an updated @all_report which includes at the end the "value" string.
Build CanvasXpress density plot from R data frame
Description
Loads data frame and CanvasXpress options for density plot, then calls canvasXpress_main to build it.
Arguments
options |
list with options. |
Details
CanvasXpress density plot
Value
HTML code for CanvasXpress density plot of data.
Retrieve Data from htmlReport Object
Description
This method retrieves data from an htmlReport
object based on specified options.
Arguments
options |
A list containing options for data retrieval. |
Details
Retrieve Data from htmlReport Object
Value
A list containing the retrieved data and additional information.
Retrieve Data from htmlReport Object
Description
This method retrieves data from an
htmlReport
object based on specified options.
Arguments
options |
A list containing options for data retrieval. |
Value
A list containing the retrieved data and additional information.
Get Data for Plotting from htmlReport Object
Description
This method retrieves data suitable for plotting from an htmlReport
object based on specified options.
Arguments
options |
A list containing options for data retrieval. |
Details
Get Data for Plotting from htmlReport Object
Value
A list containing the retrieved data, attributes, samples, and variables.
Get Plot from htmlReport Object
Description
This method generates and retrieves a plot from an htmlReport
object. This code writes the plot to a temporal png, then it loads the png in base64 encoding and then displays the plot within the HTML report.
Arguments
plot_obj |
A plot object like ggplot. |
width |
plot width |
height |
plot height |
size_unit |
units in plot size |
img_properties |
string including html properties of img |
resizable |
logical indicating if plot must be resizable |
Details
Get Plot from htmlReport Object
Value
Displays the plot within the HTML report.
Get js Plot from canvasxpress_obj Object
Description
get_plot_data
Arguments
object_id |
string indicating object id |
cvXpress |
vanvasXpress_obj object |
Value
Displays the js code for plot.
Build CanvasXpress line plot from R data frame
Description
Loads data frame and CanvasXpress options for line plot, then calls canvasXpress_main to build it.
Arguments
options |
list with options. |
Details
CanvasXpress line plot
Value
HTML code for CanvasXpress line plot of data.
Build report by loading files from disk and rendering template.
Description
Main htmlreportR script mode function. Renders a template,
Usage
main_htmlreportR(options)
Arguments
options |
list containing all necessary elements to build an htmlReport instance. |
Details
Main htmlreportR scripting function
Value
None
Examples
## Not run:
options <- list(title = "main_htmlreportR example",
data_files = "path/to/file1", "path/to/fileN",
output_file = "path/to/output",
source_folder = "path/to/package/scripts",
compress_obj = TRUE,
css_files = "path/to/custom/css",
js_files = "path/to/custom/js",
cdn_css = "path/to/cdn_css",
cdn_js = "path/to/cdn_js",
menu = "menu")
main_htmlreportR (options)
## End(Not run)
Make HTML Report Head
Description
This method generates the head section of an HTML report by adding the title to an htmlReport
object.
Details
Make HTML Report Head
Value
An updated htmlReport
object with the title added to its head section.
Print data frame in HTML format
Description
Parses a data frame included in an object of class "htmlReport" and HTML table to include it in htmlreportR
Arguments
data_frame |
Data frame to parse |
options |
list with options |
table_id |
An integer. Table id in report |
row_names |
A boolean.
|
Details
Parse data frame to HTML
Value
A table in html format.
Build CanvasXpress scatter2D plot from R data frame
Description
Loads data frame and CanvasXpress options for scatter2D plot, then calls canvasXpress_main to build it.
Arguments
options |
list with options. |
Details
CanvasXpress scatter2D plot
Value
HTML code for CanvasXpress scatter2D plot of data.
Generate static ggplot for HTML report
Description
This function generates a static ggplot for inclusion in an HTML report for an object of class "htmlReport".
Arguments
id |
A character string specifying the identifier for the element of hash_vars that is taken. |
header |
Logical, indicating whether the dataset has a header row. |
row_names |
Logical, indicating whether to include row names. |
transpose |
Logical, indicating whether to transpose the dataset. |
smp_attr |
A list of attributes for samples. |
var_attr |
A list of attributes for variables. |
fields |
A character vector specifying fields to include in the ggplot. |
func |
A function to preprocess data before plotting. |
plotting_function |
A function used for generating the ggplot. |
text |
Logical, indicating whether to convert table to text or a vector indicating the numeric fields. |
width |
plot width |
height |
plot height |
size_unit |
units in plot size |
img_properties |
string including html properties of img |
resizable |
logical indicating if plot must be resizable |
Details
Generate static ggplot for HTML report
This function generates a static ggplot based on the provided data
and plot specifications. It first defines a wrapper function for ggplot
generation, then calls the static_plot_main
function to generate the
plot and include it in the HTML report object.
Generate static plot for HTML report
Description
This function generates a static plot for inclusion in an HTML report for an object of class "htmlReport".
Arguments
id |
A character string specifying the identifier for the plot included in hash_vars. |
header |
Logical, indicating whether the dataset has a header row. |
row_names |
Logical, indicating whether to include row names. |
transpose |
Logical, indicating whether to transpose the dataset. |
smp_attr |
A list of attributes for samples. |
var_attr |
A list of attributes for variables. |
fields |
A character vector specifying the fields to include in the plot. |
func |
A function to preprocess data before plotting. |
plotting_function |
A function used for generating the plot. |
text |
Logical, indicating whether to convert table to text or a vector indicating the numeric fields. |
custom_format |
Logical, indicating if id correspond to a table or a custom object |
width |
plot width |
height |
plot height |
size_unit |
units in plot size |
img_properties |
string including html properties of img |
resizable |
logical indicating if plot must be resizable |
classic_R_plot |
logical indicating if is using classic plot() R function |
Details
Generate static plot for HTML report
This function generates a static plot based on the provided data and plot specifications. It first retrieves the data frame for plotting using the provided options, preprocesses the data if a preprocessing function is specified, generates the plot using the provided plotting function, and then adds the plot to the HTML report object.
Write HTML Report
Description
This method writes the HTML report generated by an htmlReport
object to a specified output file path.
Arguments
output_path |
A character string specifying the output file path for the HTML report. |
Details
Write HTML Report
Value
Writes the HTML report to the specified output file path and removes temporary files.