### Install robvis Package Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Install the robvis package from GitHub. Ensure you have devtools installed. ```r if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") devtools::install_github("mcguinlu/robvis") ``` -------------------------------- ### Load example data Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Load the example dataset included with the robvis package. This dataset can be used to follow along with the package's tutorials and examples. ```r data(robvis) ``` -------------------------------- ### Install robvis package Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Install the robvis package from GitHub. This is the first step before using any of the package's functionalities. ```r remotes::install_github("mcguinlu/robvis") ``` -------------------------------- ### Load Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Load the built-in example dataset 'robvis_data' for demonstration purposes. This dataset contains sample robotic vision data. ```r data(robvis_data) ``` -------------------------------- ### Install robvis Package Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Install the robvis package from Bioconductor. This is the first step before using any of its functionalities. ```r if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") # BiocManager::install(version = "3.18") # Uncomment to set BiocManager version BiocManager::install("robvis") ``` -------------------------------- ### Structure of data_rob1 Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Illustrates the structure of the `data_rob1` example dataset, a generic example for ROB1 assessments. This dataset uses full domain names instead of abbreviated codes like D1, D2. ```r # Structure: 9 obs. of 9 variables # Columns are full domain names instead of D1, D2, etc.: # Study # Random.sequence.generation ``` -------------------------------- ### Minimal robvis Example Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/README.md Demonstrates the basic usage of robvis by creating a summary plot and a traffic light plot using built-in example data, and saving the summary plot to a file. ```r library(robvis) # Use built-in example data for ROB2.0 data <- data_rob2 # Create summary plot summary_plot <- rob_summary(data, tool = "ROB2") plot(summary_plot) # Create traffic light plot traffic_plot <- rob_traffic_light(data, tool = "ROB2") plot(traffic_plot) # Save to file rob_save(summary_plot, file = "rob_summary.png") ``` -------------------------------- ### Install robvis package Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Install the robvis package from Bioconductor. This is the first step before using any of the package's functionalities. ```r if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("robvis") ``` -------------------------------- ### Install robvis package Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Install the robvis package from GitHub using the devtools package. This is the primary method for obtaining the latest version. ```r if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") # Install robvis from GitHub devtools::install_github("mcguinlu/robvis") ``` -------------------------------- ### Load robvis and robyn Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Load the robvis package and the robyn object for visualization. Ensure robyn is installed. ```r library(robvis) library(robyn) robyn_object <- robyn_object ``` -------------------------------- ### Structure of data_quips Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Shows the structure of the `data_quips` example dataset for QUIPS assessments of prognostic factor studies. It contains 6 domains, Study, and Overall columns. ```r # Structure: 12 obs. of 8 variables # Domains (D1-D6): # D1: Bias due to participation # D2: Bias due to attrition # D3: Bias due to prognostic factor measurement # D4: Bias due to outcome measurement # D5: Bias due to confounding # D6: Bias in statistical analysis and reporting ``` -------------------------------- ### Load Example RNA-Seq Data Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Load the example RNA-Seq dataset included with the robvis package. This dataset can be used for practicing the package's functions. ```r data(robvis.data) ``` -------------------------------- ### Structure of data_quadas Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Presents the structure of the `data_quadas` example dataset for QUADAS-2 assessments of diagnostic accuracy studies. It includes 4 domains plus Study and Overall columns. ```r # Structure: 12 obs. of 6 variables # Domains (D1-D4): # D1: Patient selection # D2: Index test # D3: Reference standard # D4: Flow and timing ``` -------------------------------- ### Load robvis package Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Before using robvis, ensure the package is installed and loaded into your R session. This is a standard first step for any R package. ```r library(robvis) ``` -------------------------------- ### Install robvis Development Version Source: https://github.com/mcguinlu/robvis/blob/main/README.md Install the development version of the robvis package from GitHub using the devtools package. This version includes new functionality and bug fixes. ```r install.packages("devtools") devtools::install_github("mcguinlu/robvis") ``` -------------------------------- ### Structure of data_rob2_cluster Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Provides the structure for the `data_rob2_cluster` example dataset, a variant of ROB2.0 for cluster-randomized trials. It highlights the inclusion of an additional domain (D1b) related to timing. ```r # Structure: 9 studies with 8 columns (includes D1b) # D1: Bias arising from the randomization process # D1b: Bias from timing of identification and recruitment # D2-D5: Same as standard ROB2.0 ``` -------------------------------- ### Structure of data_robins_e Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Outlines the structure of the `data_robins_e` example dataset for ROBINS-E assessments of non-randomized exposure studies. It comprises 7 domains, Study, and Overall columns. ```r # Structure: 10 obs. of 9 variables (7 domains + Study + Overall) # Domains (D1-D7): # D1: Bias due to confounding # D2: Bias arising from measurement of the exposure # D3: Bias in selection of participants into the study # D4: Bias due to post-exposure interventions # D5: Bias due to missing data # D6: Bias arising from measurement of the outcome # D7: Bias in selection of the reported result ``` -------------------------------- ### AJAX Helper Functions (get, post) Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/articles/metafor.html Provides convenience methods for making GET and POST requests. These functions simplify common AJAX scenarios by abstracting away some of the default configurations. ```JavaScript S.getJSON=function(e,t,n){return S.get(e,t,n,"json")},S.getScript=function(e,t){return S.get(e,void 0,t,"script")}},S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}) ``` -------------------------------- ### Structure of data_rob2 Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Displays the structure of the `data_rob2` example dataset, which is used for ROB2.0 assessments of randomized controlled trials. It shows the number of observations, variables, and the data types of each column. ```r # Structure str(data_rob2) # 'data.frame': 9 obs. of 7 variables: # $ Study : chr "Study 1" "Study 2" ... # $ D1 : chr "Low" "Low" ... # $ D2 : chr "Low" "Low" ... # $ D3 : chr "Low" "Low" ... # $ D4 : chr "Low" "Low" ... # $ D5 : chr "Low" "Low" ... # $ Overall: chr "Low" "Low" ... # Domains # D1: Bias arising from the randomization process # D2: Bias due to deviations from intended interventions # D3: Bias due to missing outcome data # D4: Bias in measurement of the outcome # D5: Bias in selection of the reported result ``` -------------------------------- ### Create a color scheme from a palette name Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html This example shows how to create a color scheme by specifying a predefined palette name. Robvis supports various standard palettes, simplifying the process of applying well-established color sets. ```R colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") colour("ESIAESIAESIAESIAESIAESIAESIAESIA") ``` -------------------------------- ### Structure of data_robins_i Example Dataset Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Details the structure of the `data_robins_i` example dataset, used for ROBINS-I assessments of non-randomized intervention studies. It includes 7 domains plus Study and Overall columns. ```r # Structure: 10 obs. of 9 variables (7 domains + Study + Overall) # Domains (D1-D7): # D1: Bias due to confounding # D2: Bias due to selection of participants # D3: Bias in classification of interventions # D4: Bias due to deviations from intended interventions # D5: Bias due to missing data # D6: Bias in measurement of outcomes # D7: Bias in selection of the reported result ``` -------------------------------- ### rob_dummy() Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/README.md Generates example risk-of-bias dataframes for testing and demonstration purposes. ```APIDOC ## rob_dummy() ### Description Generates example risk-of-bias dataframes for testing and demonstration purposes. ### Method `rob_dummy(n, tool = "ROB2", study = TRUE)` ### Parameters - **n** (numeric) - The number of studies to generate data for. - **tool** (string) - The risk-of-bias assessment tool to generate data for. Defaults to "ROB2". - **study** (boolean) - Whether to include study identifiers. Defaults to TRUE. ### Response - Returns a data.frame with dummy risk-of-bias assessment data. ``` -------------------------------- ### Initialize Google Analytics Data Layer and gtag Source: https://github.com/mcguinlu/robvis/blob/main/robvisapp/google-analytics.html Sets up the Google Analytics data layer and initializes the gtag function for sending data. This is a standard setup for Google Analytics. ```javascript window.dataLayer = window.dataLayer || []; function gtag(){ dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'UA-139874649-1'); ``` -------------------------------- ### Basic rob_summary() Usage with ROB2.0 Data Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/api-reference/rob_summary.md Demonstrates basic usage of the rob_summary function with the ROB2 tool using built-in example data. The resulting plot can be displayed using the plot() function. ```r library(robvis) # Using built-in example data summary_plot <- rob_summary(data = data_rob2, tool = "ROB2") plot(summary_plot) ``` -------------------------------- ### Basic Workflow for Appending Weights Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/api-reference/rob_append_weights.md Demonstrates the complete process from preparing meta-analysis data to visualizing a weighted ROB plot. Ensure the 'robvis', 'metafor', and 'metadat' libraries are loaded. ```r library(robvis) library(metafor) library(metadat) # Step 1: Prepare data and calculate effect sizes dat <- metadat::dat.bcg[c(1:9), ] dat <- metafor::escalc( measure = "RR", ai = tpos, bi = tneg, ci = cpos, di = cneg, data = dat, slab = paste(author, year) ) # Step 2: Fit meta-analysis model res <- metafor::rma(yi, vi, data = dat) # Step 3: Create risk-of-bias dataset (7 columns: Study + 5 domains + Overall) data_rob2$Study <- paste(dat$author, dat$year) rob_data_subset <- data_rob2[1:9, 1:7] # Step 4: Append weights from meta-analysis rob_weighted_data <- rob_append_weights(rob_data_subset, res) # Step 5: Create weighted barplot summary_plot <- rob_summary(rob_weighted_data, tool = "ROB2", weighted = TRUE) plot(summary_plot) ``` -------------------------------- ### Creating a data.frame from scratch Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md This snippet shows how to manually create a data.frame for ROB assessments, specifying study names and judgments for different domains. ```r rob_data <- data.frame( Study = c("Author 2020", "Author 2021"), D1 = c("Low", "High"), D2 = c("Low", "Some concerns"), D3 = c("Low", "Low"), D4 = c("Low", "Low"), D5 = c("Low", "High"), Overall = c("Low", "High"), stringsAsFactors = FALSE ) ``` -------------------------------- ### Install robvis CRAN Version Source: https://github.com/mcguinlu/robvis/blob/main/README.md Install the stable version of the robvis package from CRAN. Use this command if you prefer the version available on the Comprehensive R Archive Network. ```r install.packages("robvis") ``` -------------------------------- ### Use Predefined Color Scheme Source: https://github.com/mcguinlu/robvis/blob/main/README.md Demonstrates how to use the 'colourblind' predefined color scheme in the rob_summary function. ```r rob_summary(data = data_rob2, tool = "ROB2", colour = "colourblind") ``` -------------------------------- ### Load Libraries and Prepare Data Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/articles/metafor.html Loads necessary libraries (robvis, metafor, dplyr) and prepares the BCG dataset for meta-analysis, combining it with dummy ROB2 data. ```R library(robvis) library(metafor) library(dplyr) # Define your studies, using the BCG dataset included in the metadat package dat_bcg <- metadat::dat.bcg glimpse(dat_bcg) # Create some example data for ROB2 using rob_dummy(), and add it to the BCG # data. # We don't need a "Study" column for this example, so we set `study = FALSE` dat_rob <- rob_dummy(13, "ROB2", study = FALSE) dat_analysis <- cbind(dat_bcg, dat_rob) glimpse(dat_analysis) ``` -------------------------------- ### Basic Data Import and Visualization Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Demonstrates how to load data into robvis and create a basic forest plot. Ensure your data is in the correct format. ```r library(robvis) data("robvis_data") robvis(robvis_data, x = "riskofbias", y = "comparison", colour = "overallrisk", legend.title = "Overall Risk", x.title = "Risk of Bias Assessment", y.title = "Comparison", colour.title = "Overall Risk", plot.title = "Forest Plot of Risk of Bias", legend.position = "right", x.rotate = 45, y.rotate = 0, text.size = 3.5, point.size = 2.5, line.size = 0.5, x.range = c(0, 1), y.range = c(0, 1), legend.bottom = FALSE, legend.right = TRUE, plot.type = "forestplot") ``` -------------------------------- ### Use Dummy Data for Visualization Testing Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/api-reference/rob_dummy.md Demonstrates generating dummy data for the QUADAS-2 tool and then using it to create and plot summary and traffic light visualizations. This is ideal for validating visualization functions. ```r # Generate and immediately visualize dummy <- rob_dummy(n = 20, tool = "QUADAS-2") # Create summary plot summary_plot <- rob_summary(dummy, tool = "QUADAS-2") plot(summary_plot) # Create traffic light plot traffic_plot <- rob_traffic_light(dummy, tool = "QUADAS-2") plot(traffic_plot) ``` -------------------------------- ### Creating a Sample Metadata Data Frame Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Construct a sample metadata data frame that can be used with `robvis` functions. This data frame should contain columns for sample IDs and any grouping or condition variables. ```r sample_metadata <- data.frame( sample_id = c("Sample1", "Sample2", "Sample3", "Sample4"), group = c("A", "A", "B", "B"), condition = c("Control", "Treated", "Control", "Treated") ) ``` -------------------------------- ### Build Tabsets Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/articles/metafor.html Initializes tabset functionality for the page. This is typically called when the document is ready. ```javascript $(document).ready(function () { window.buildTabsets("TOC"); }); ``` -------------------------------- ### Basic robvis plot Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/Introduction_to_robvis.html Generates a standard risk of bias plot. Ensure the 'robvis' package is installed and loaded. ```R library(robvis) robvis(systematic_review = "robvis_data.csv", legend_position = "bottom", colors = c("#4E79A7", "#F28E2B", "#E15759", "#76B7B2", "#59A14F", "#EDC948", "#B07AA1", "#FF9DA7", "#9C755F", "#868686")) ``` -------------------------------- ### Get CSS Property Value Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/articles/metafor.html Retrieves the computed value of a CSS property for an element. It handles different property names and units. ```javascript S.css=function(e,t,n,r){ var i,o,a,s=X(t); return Xe.test(t)|| (t=ze(s)), (a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&& (i=a.get(e,!0,n)), void 0===i&& (i=We(e,t,r)), "normal"===i&& t in Ge&& (i=Ge[t]), ""===n|| n?( (o=parseFloat(i),!0===n|| isFinite(o)?o||0: i)): i } ``` -------------------------------- ### Configure Generic Tool Parameters Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/configuration.md Use this snippet to customize domain labels and titles when the 'Generic' tool is selected. Ensure the number of domain shortcodes matches the number of domains in your data. ```r rob_traffic_light( data = custom_data, tool = "Generic", domain_shortcodes = c("Design", "Methods", "Analysis"), x_title = "Methodological Domain", y_title = "First Author and Year", judgement_title = "Risk Assessment", judgement_labels = c( c = "Critical Concern", h = "High Concern", s = "Moderate Concern", l = "Low Concern", n = "Insufficient Data", x = "Not Applicable" ) ) ``` -------------------------------- ### Get Element Dimension with Box Sizing Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/articles/metafor.html Retrieves the computed dimension (height or width) of an element, correctly accounting for box-sizing, padding, and borders. ```javascript function Je(e,t,n){ var r=Re(e), i=(!y.boxSizingReliable()|| n)&&"border-box"===S.css(e,"boxSizing",!1,r), o=i; a=We(e,t,r); s="offset"+t[0].toUpperCase()+t.slice(1); if(Pe.test(a)){ if(!n)return a; a="auto" } return (!y.boxSizingReliable()&&i|| !y.reliableTrDimensions()&& A(e,"tr")|| "auto"===a|| !parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&& (e.getClientRects().length&& (i="border-box"===S.css(e,"boxSizing",!1,r), (o=s in e)&&(a=e[s]))) ; (a=parseFloat(a)||0)+Qe(e,t,n|| (i?"border":"content"),o,r,a)+"px" } ``` -------------------------------- ### Meta-Analysis with Different Models Source: https://github.com/mcguinlu/robvis/blob/main/vignettes/articles/metafor.html Demonstrates fitting meta-analysis models using different estimation methods. ```r res.ml <- rma(yi, vi, method = "ML", data = dat.bcg) res.reml <- rma(yi, vi, method = "REML", data = dat.bcg) res.dl <- rma(yi, vi, method = "DL", data = dat.bcg) res.pm <- rma(yi, vi, method = "PM", data = dat.bcg) res.ie <- rma(yi, vi, method = "IE", data = dat.bcg) res.is <- rma(yi, vi, method = "IS", data = dat.bcg) ``` -------------------------------- ### Preparing weighted data with metafor Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md This pattern demonstrates appending weights from a meta-analysis result (rma object) to the ROB data and verifying that the weights sum to approximately 100. ```r # Append weights from meta-analysis library(metafor) res <- metafor::rma(yi, vi, data = dat) rob_weighted <- rob_append_weights(rob_data, res) # Verify weights sum to 100 sum(rob_weighted$Weight) # Should be approximately 100 ``` -------------------------------- ### Type Checking for rma class Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md Robvis performs implicit type validation. This example shows a check to ensure a result object is of class 'rma'. ```r # Function expects rma class if (!("rma" %in% class(res))) { stop("Result objects need to be of class 'meta'") } ``` -------------------------------- ### Type Checking for numeric column Source: https://github.com/mcguinlu/robvis/blob/main/_autodocs/types.md This example demonstrates a check to ensure a specific column in a data frame is numeric, which is required for operations like weight calculations. ```r # Function expects numeric column for weights if (is.numeric(data[2, ncol(data)]) == FALSE) { stop("Error. The final column does not seem to contain numeric values") } ```