Usage
-
highlight_data(x, rows = NULL, columns = NULL, locations = NULL)
+ highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)
+
+# S3 method for numeric
+highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)
+
+# S3 method for integer
+highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)
+
+# S3 method for vector
+highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)
+
+# S3 method for matrix
+highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)
+
+# S3 method for default
+highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)
highlight_rows(x, rows = NULL)
@@ -72,24 +87,30 @@
Examples
-
# Example data
-x = matrix(1:12, nrow = 4)
+ ## 2D Highlighting for Matrices ----
+# Example data
+x <- matrix(1:12, nrow = 4)
# Highlight points using an x, y pairing
-locations = rbind(
+locations <- rbind(
c(1, 3),
c(2, 2),
c(4, 1)
@@ -140,6 +161,11 @@ Examples#> [2,] TRUE FALSE FALSE
#> [3,] TRUE FALSE FALSE
#> [4,] TRUE FALSE FALSE
+
+## 1D Highlighting for Vectors ----
+vec <- c(3, NA, -1, 2, NaN, Inf, 42)
+highlight_data(vec, locations = c(2, 4, 6))
+#> [1] FALSE TRUE FALSE TRUE FALSE TRUE FALSE
diff --git a/search.json b/search.json
index b04bc03..e522d36 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"James Joseph Balamuta. Author, maintainer.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Balamuta J (2024). drawr: Create Graphics 'R' Data Structures. R package version 0.0.1, https://r-pkg.thecoatlessprofessor.com/drawr/, https://github.com/coatless-rpkg/drawr.","code":"@Manual{, title = {drawr: Create Graphics of 'R' Data Structures}, author = {James Joseph Balamuta}, year = {2024}, note = {R package version 0.0.1, https://r-pkg.thecoatlessprofessor.com/drawr/}, url = {https://github.com/coatless-rpkg/drawr}, }"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"drawr","dir":"","previous_headings":"","what":"Create Graphics of R Data Structures","title":"Create Graphics of R Data Structures","text":"goal drawr draw different R data structures graphs.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Create Graphics of R Data Structures","text":"can install development version drawr GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"coatless-rpkg/drawr\")"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"design","dir":"","previous_headings":"","what":"Design","title":"Create Graphics of R Data Structures","text":"package designed take advantage base R graphics alongside ggplot2. ’re providing two different implementations system naming scheme : draw_*(): base R graphics gdraw_*(): ggplot2","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Create Graphics of R Data Structures","text":"Take instance matrix looks like : wanted see contents laid indices specific cells highlighted? can achieve similar results ggplot2 function.","code":"mat_3x5 = matrix( c( 1, NA, 3, 4, NaN, NA, 7, 8, -9, 10, -11, 12, -Inf, -14, NA ), ncol = 5, byrow = TRUE) mat_3x5 #> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 NA 3 4 NaN #> [2,] NA 7 8 -9 10 #> [3,] -11 12 -Inf -14 NA # Load the library library(drawr) # Graphic of matrix data structure using base R graphics draw_matrix(mat_3x5) # Show the cell indices draw_matrix(mat_3x5, show_indices = \"cell\") # Show all indices draw_matrix(mat_3x5, show_indices = \"all\") # Highlight cells over a specific value draw_matrix(mat_3x5, highlight_area = mat_3x5 > 4) # Graphic of matrix data structure using base R graphics gdraw_matrix(mat_3x5) # Highlight cells in specific columns gdraw_matrix(mat_3x5, show_indices = c(\"row\", \"column\"), highlight_area = highlight_columns(mat_3x5, columns = 2:4))"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Visualize Data Inside of a Matrix — draw_matrix","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"Generate graph showing contents matrix.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"","code":"draw_matrix( data, show_indices = \"none\", highlight_area = matrix(FALSE, nrow = nrow(data), ncol = ncol(data)), highlight_color = \"lemonchiffon\", graph_title = paste0(\"Data Object: \", deparse(substitute(data))), graph_subtitle = paste0(\"Dimensions: \", paste(n_row, \"rows x\", n_col, \"columns\"), \" | \", \"Data Type: \", paste(class(data), collapse = \", \")) ) gdraw_matrix( data, show_indices = \"none\", highlight_area = matrix(FALSE, nrow(data), ncol(data)), highlight_color = \"lemonchiffon\", graph_title = paste0(\"Data Object: \", deparse(substitute(data))), graph_subtitle = paste0(\"Dimensions: \", paste(n_row, \"rows x\", n_col, \"columns\"), \" | \", \"Data Type: \", paste(class(data), collapse = \", \")) )"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"data object class matrix. show_indices Display indices based location. Options : \"none\": indices, \"cell\": matrix cell indices [, j], \"row\": row indices [, ] left matrix, \"column\": column indices [,j] matrix, \"\": row, column, inside options. Default: \"none\". highlight_area Matrix logical values provide mask cells filled. Default: None. highlight_color Color use fill background cell. graph_title Title appear upper left hand corner graph. graph_subtitle Subtitle appear immediately graph title upper left hand side graph.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"","code":"# Base graphics # Visualize a 3x3 mat_3x3 = matrix(c(10, 200, -30, 40, 500, 30, 90, -55, 10), ncol = 3) draw_matrix(mat_3x3) # Show the cell indices draw_matrix(mat_3x3, show_indices = \"cell\") # Highlight a row mat_4x4 = matrix(seq_len(16), nrow = 4) draw_matrix( mat_4x4, show_indices = \"row\", highlight_area = highlight_rows(mat_4x4, rows = 1) ) # Highlight values above 5 mat_2x4 = matrix(round(rnorm(16, 5, 2), 2), ncol = 4) draw_matrix(mat_2x4, highlight_area = mat_2x4 > 2) # ggplot2 graphics ---- # Visualize a 3x3 mat_3x3 = matrix(c(10, 200, -30, 40, 500, 30, 90, -55, 10), ncol = 3) gdraw_matrix(mat_3x3) # View the matrix without indices present gdraw_matrix(mat_3x3, highlight_area = FALSE) # Highlight a row mat_2x2 = matrix(c(1, 2, 3, 4), nrow = 2) mat_2x2_mask = matrix(c(TRUE, TRUE, FALSE, FALSE), nrow = 2) gdraw_matrix(mat_2x2, highlight_area = mat_2x2_mask) # Highlight values above 5 mat_3x5 = matrix(round(rnorm(15, 5, 2), 2), ncol = 5) gdraw_matrix(mat_3x5, highlight_area = mat_3x5 > 2)"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":null,"dir":"Reference","previous_headings":"","what":"Visualize Data Inside of a Vector — draw_vector","title":"Visualize Data Inside of a Vector — draw_vector","text":"Generate graph showing contents Vector","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Visualize Data Inside of a Vector — draw_vector","text":"","code":"draw_vector( data, layout = c(\"vertical\", \"horizontal\"), show_indices = c(\"none\", \"inside\", \"outside\"), highlight_area = rep(FALSE, length(data)), highlight_color = \"lemonchiffon\", graph_title = paste0(\"Data Object: \", deparse(substitute(data))), graph_subtitle = paste0(\"Length: \", length(data), \" elements | \", \"Data Type: \", paste(class(data), collapse = \", \")) )"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Visualize Data Inside of a Vector — draw_vector","text":"data object class vector. layout Orientation vector. Default: \"vertical\". show_indices Display data indices either: \"inside\", \"outside\", \"none\" vector cell, e.g. []. Default: \"none\" highlight_area Vector logical values provide mask cells filled. Default: None. highlight_color Color use fill background cell. graph_title Title appear upper left hand corner graph. graph_subtitle Subtitle appear immediately graph title upper left hand side graph.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Visualize Data Inside of a Vector — draw_vector","text":"","code":"# Base graphics # Visualize a vector with 5 elements vec_5 <- round(rnorm(5, 0, 4), 2) draw_vector(vec_5) # Visualize a 6 element vector with indices underneath data vec_6 <- c(-3, 5, NA, Inf, 2, 1) draw_vector(vec_6, show_indices = \"inside\") # Highlight the 2nd, 4th, and 6th cell with indices shown outside draw_vector(vec_6, show_indices = \"outside\", highlight_area = c(2, 4, 6))"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/drawr-package.html","id":null,"dir":"Reference","previous_headings":"","what":"drawr: Create Graphics of 'R' Data Structures — drawr-package","title":"drawr: Create Graphics of 'R' Data Structures — drawr-package","text":"Visualize contents different 'R' data structures.","code":""},{"path":[]},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/drawr-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"drawr: Create Graphics of 'R' Data Structures — drawr-package","text":"Maintainer: James Joseph Balamuta james.balamuta@gmail.com (ORCID)","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":null,"dir":"Reference","previous_headings":"","what":"Highlight a matrix — highlight_data","title":"Highlight a matrix — highlight_data","text":"Generate matrix active areas.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Highlight a matrix — highlight_data","text":"","code":"highlight_data(x, rows = NULL, columns = NULL, locations = NULL) highlight_rows(x, rows = NULL) highlight_columns(x, columns = NULL) highlight_locations(x, locations = NULL)"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Highlight a matrix — highlight_data","text":"x matrix. rows interger vector valid row index locations. columns integer vector containing valid column indexlocations. locations m 2 matrix points listed x, y format.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Highlight a matrix — highlight_data","text":"logical matrix required rows /columns points set TRUE. values given FALSE.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Highlight a matrix — highlight_data","text":"","code":"# Example data x = matrix(1:12, nrow = 4) # Highlight points using an x, y pairing locations = rbind( c(1, 3), c(2, 2), c(4, 1) ) highlight_locations(x, locations) #> [,1] [,2] [,3] #> [1,] FALSE FALSE TRUE #> [2,] FALSE TRUE FALSE #> [3,] FALSE FALSE FALSE #> [4,] TRUE FALSE FALSE # Highlight entries only in the 1st and 3rd rows. highlight_rows(x, rows = c(1, 3)) #> [,1] [,2] [,3] #> [1,] TRUE TRUE TRUE #> [2,] FALSE FALSE FALSE #> [3,] TRUE TRUE TRUE #> [4,] FALSE FALSE FALSE # Highlight entries only in the first two rows: highlight_rows(x, rows = 1:2) #> [,1] [,2] [,3] #> [1,] TRUE TRUE TRUE #> [2,] TRUE TRUE TRUE #> [3,] FALSE FALSE FALSE #> [4,] FALSE FALSE FALSE # Highlight entries in the last column highlight_columns(x, columns = ncol(x)) #> [,1] [,2] [,3] #> [1,] FALSE FALSE TRUE #> [2,] FALSE FALSE TRUE #> [3,] FALSE FALSE TRUE #> [4,] FALSE FALSE TRUE # Highlight entries in the first column highlight_columns(x, columns = 1) #> [,1] [,2] [,3] #> [1,] TRUE FALSE FALSE #> [2,] TRUE FALSE FALSE #> [3,] TRUE FALSE FALSE #> [4,] TRUE FALSE FALSE # Highlight entries in the first column or first row. highlight_data(x, rows = 1, columns = 1) #> [,1] [,2] [,3] #> [1,] TRUE TRUE TRUE #> [2,] TRUE FALSE FALSE #> [3,] TRUE FALSE FALSE #> [4,] TRUE FALSE FALSE"}]
+[{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"James Joseph Balamuta. Author, maintainer.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Balamuta J (2024). drawr: Create Graphics 'R' Data Structures. R package version 0.0.1, https://r-pkg.thecoatlessprofessor.com/drawr/, https://github.com/coatless-rpkg/drawr.","code":"@Manual{, title = {drawr: Create Graphics of 'R' Data Structures}, author = {James Joseph Balamuta}, year = {2024}, note = {R package version 0.0.1, https://r-pkg.thecoatlessprofessor.com/drawr/}, url = {https://github.com/coatless-rpkg/drawr}, }"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"drawr","dir":"","previous_headings":"","what":"Create Graphics of R Data Structures","title":"Create Graphics of R Data Structures","text":"goal drawr draw different R data structures graphs.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Create Graphics of R Data Structures","text":"can install development version drawr GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"coatless-rpkg/drawr\")"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"design","dir":"","previous_headings":"","what":"Design","title":"Create Graphics of R Data Structures","text":"package designed take advantage base R graphics alongside ggplot2. ’re providing two different implementations system naming scheme : draw_*(): base R graphics gdraw_*(): ggplot2","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Create Graphics of R Data Structures","text":"Take instance matrix looks like : wanted see contents laid indices specific cells highlighted? can achieve similar results ggplot2 function.","code":"mat_3x5 = matrix( c( 1, NA, 3, 4, NaN, NA, 7, 8, -9, 10, -11, 12, -Inf, -14, NA ), ncol = 5, byrow = TRUE) mat_3x5 #> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 NA 3 4 NaN #> [2,] NA 7 8 -9 10 #> [3,] -11 12 -Inf -14 NA # Load the library library(drawr) # Graphic of matrix data structure using base R graphics draw_matrix(mat_3x5) # Show the cell indices draw_matrix(mat_3x5, show_indices = \"cell\") # Show all indices draw_matrix(mat_3x5, show_indices = \"all\") # Highlight cells over a specific value draw_matrix(mat_3x5, highlight_area = mat_3x5 > 4) # Graphic of matrix data structure using base R graphics gdraw_matrix(mat_3x5) # Highlight cells in specific columns gdraw_matrix(mat_3x5, show_indices = c(\"row\", \"column\"), highlight_area = highlight_columns(mat_3x5, columns = 2:4))"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Visualize Data Inside of a Matrix — draw_matrix","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"Generate graph showing contents matrix.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"","code":"draw_matrix( data, show_indices = \"none\", highlight_area = matrix(FALSE, nrow = nrow(data), ncol = ncol(data)), highlight_color = \"lemonchiffon\", graph_title = paste0(\"Data Object: \", deparse(substitute(data))), graph_subtitle = paste0(\"Dimensions: \", paste(n_row, \"rows x\", n_col, \"columns\"), \" | \", \"Data Type: \", paste(class(data), collapse = \", \")) ) gdraw_matrix( data, show_indices = \"none\", highlight_area = matrix(FALSE, nrow(data), ncol(data)), highlight_color = \"lemonchiffon\", graph_title = paste0(\"Data Object: \", deparse(substitute(data))), graph_subtitle = paste0(\"Dimensions: \", paste(n_row, \"rows x\", n_col, \"columns\"), \" | \", \"Data Type: \", paste(class(data), collapse = \", \")) )"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"data object class matrix. show_indices Display indices based location. Options : \"none\": indices, \"cell\": matrix cell indices [, j], \"row\": row indices [, ] left matrix, \"column\": column indices [,j] matrix, \"\": row, column, inside options. Default: \"none\". highlight_area Matrix logical values provide mask cells filled. Default: None. highlight_color Color use fill background cell. graph_title Title appear upper left hand corner graph. graph_subtitle Subtitle appear immediately graph title upper left hand side graph.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Visualize Data Inside of a Matrix — draw_matrix","text":"","code":"# Base graphics # Visualize a 3x3 mat_3x3 = matrix(c(10, 200, -30, 40, 500, 30, 90, -55, 10), ncol = 3) draw_matrix(mat_3x3) # Show the cell indices draw_matrix(mat_3x3, show_indices = \"cell\") # Highlight a row mat_4x4 = matrix(seq_len(16), nrow = 4) draw_matrix( mat_4x4, show_indices = \"row\", highlight_area = highlight_rows(mat_4x4, rows = 1) ) # Highlight values above 5 mat_2x4 = matrix(round(rnorm(16, 5, 2), 2), ncol = 4) draw_matrix(mat_2x4, highlight_area = mat_2x4 > 2) # ggplot2 graphics ---- # Visualize a 3x3 mat_3x3 = matrix(c(10, 200, -30, 40, 500, 30, 90, -55, 10), ncol = 3) gdraw_matrix(mat_3x3) # View the matrix without indices present gdraw_matrix(mat_3x3, highlight_area = FALSE) # Highlight a row mat_2x2 = matrix(c(1, 2, 3, 4), nrow = 2) mat_2x2_mask = matrix(c(TRUE, TRUE, FALSE, FALSE), nrow = 2) gdraw_matrix(mat_2x2, highlight_area = mat_2x2_mask) # Highlight values above 5 mat_3x5 = matrix(round(rnorm(15, 5, 2), 2), ncol = 5) gdraw_matrix(mat_3x5, highlight_area = mat_3x5 > 2)"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":null,"dir":"Reference","previous_headings":"","what":"Visualize Data Inside of a Vector — draw_vector","title":"Visualize Data Inside of a Vector — draw_vector","text":"Generate graph showing contents Vector","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Visualize Data Inside of a Vector — draw_vector","text":"","code":"draw_vector( data, layout = c(\"vertical\", \"horizontal\"), show_indices = c(\"none\", \"inside\", \"outside\"), highlight_area = rep(FALSE, length(data)), highlight_color = \"lemonchiffon\", graph_title = paste0(\"Data Object: \", deparse(substitute(data))), graph_subtitle = paste0(\"Length: \", length(data), \" elements | \", \"Data Type: \", paste(class(data), collapse = \", \")) )"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Visualize Data Inside of a Vector — draw_vector","text":"data object class vector. layout Orientation vector. Default: \"vertical\". show_indices Display data indices either: \"inside\", \"outside\", \"none\" vector cell, e.g. []. Default: \"none\" highlight_area Vector logical values provide mask cells filled. Default: None. highlight_color Color use fill background cell. graph_title Title appear upper left hand corner graph. graph_subtitle Subtitle appear immediately graph title upper left hand side graph.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/draw-vector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Visualize Data Inside of a Vector — draw_vector","text":"","code":"# Base graphics # Visualize a vector with 5 elements vec_5 <- round(rnorm(5, 0, 4), 2) draw_vector(vec_5) # Visualize a 6 element vector with indices underneath data vec_6 <- c(-3, 5, NA, Inf, 2, 1) draw_vector(vec_6, layout = \"horizontal\", show_indices = \"inside\") # Highlight the 2nd, 4th, and 6th cell with indices shown outside draw_vector( vec_6, show_indices = \"outside\", highlight_area = highlight_locations(vec_6, c(2, 4, 6)) ) # Highlight the 4th-6th cells with indices shown inside draw_vector( vec_6, show_indices = \"inside\", highlight_area = highlight_locations(vec_6, 4:6) )"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/drawr-package.html","id":null,"dir":"Reference","previous_headings":"","what":"drawr: Create Graphics of 'R' Data Structures — drawr-package","title":"drawr: Create Graphics of 'R' Data Structures — drawr-package","text":"Visualize contents different 'R' data structures.","code":""},{"path":[]},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/drawr-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"drawr: Create Graphics of 'R' Data Structures — drawr-package","text":"Maintainer: James Joseph Balamuta james.balamuta@gmail.com (ORCID)","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":null,"dir":"Reference","previous_headings":"","what":"Highlight data — highlight_data","title":"Highlight data — highlight_data","text":"Generate logical structure codifies active areas.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Highlight data — highlight_data","text":"","code":"highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...) # S3 method for numeric highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...) # S3 method for integer highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...) # S3 method for vector highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...) # S3 method for matrix highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...) # S3 method for default highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...) highlight_rows(x, rows = NULL) highlight_columns(x, columns = NULL) highlight_locations(x, locations = NULL)"},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Highlight data — highlight_data","text":"x matrix. rows interger vector valid row index locations. columns integer vector containing valid column indexlocations. locations m 2 matrix points listed x, y format 2D object vector integer indices 1D format. ... Additional values (used)","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Highlight data — highlight_data","text":"logical matrix vector required rows /columns points set TRUE. values given FALSE.","code":""},{"path":"http://r-pkg.thecoatlessprofessor.com/drawr/reference/highlight-data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Highlight data — highlight_data","text":"","code":"## 2D Highlighting for Matrices ---- # Example data x <- matrix(1:12, nrow = 4) # Highlight points using an x, y pairing locations <- rbind( c(1, 3), c(2, 2), c(4, 1) ) highlight_locations(x, locations) #> [,1] [,2] [,3] #> [1,] FALSE FALSE TRUE #> [2,] FALSE TRUE FALSE #> [3,] FALSE FALSE FALSE #> [4,] TRUE FALSE FALSE # Highlight entries only in the 1st and 3rd rows. highlight_rows(x, rows = c(1, 3)) #> [,1] [,2] [,3] #> [1,] TRUE TRUE TRUE #> [2,] FALSE FALSE FALSE #> [3,] TRUE TRUE TRUE #> [4,] FALSE FALSE FALSE # Highlight entries only in the first two rows: highlight_rows(x, rows = 1:2) #> [,1] [,2] [,3] #> [1,] TRUE TRUE TRUE #> [2,] TRUE TRUE TRUE #> [3,] FALSE FALSE FALSE #> [4,] FALSE FALSE FALSE # Highlight entries in the last column highlight_columns(x, columns = ncol(x)) #> [,1] [,2] [,3] #> [1,] FALSE FALSE TRUE #> [2,] FALSE FALSE TRUE #> [3,] FALSE FALSE TRUE #> [4,] FALSE FALSE TRUE # Highlight entries in the first column highlight_columns(x, columns = 1) #> [,1] [,2] [,3] #> [1,] TRUE FALSE FALSE #> [2,] TRUE FALSE FALSE #> [3,] TRUE FALSE FALSE #> [4,] TRUE FALSE FALSE # Highlight entries in the first column or first row. highlight_data(x, rows = 1, columns = 1) #> [,1] [,2] [,3] #> [1,] TRUE TRUE TRUE #> [2,] TRUE FALSE FALSE #> [3,] TRUE FALSE FALSE #> [4,] TRUE FALSE FALSE ## 1D Highlighting for Vectors ---- vec <- c(3, NA, -1, 2, NaN, Inf, 42) highlight_data(vec, locations = c(2, 4, 6)) #> [1] FALSE TRUE FALSE TRUE FALSE TRUE FALSE"}]