diff --git a/index.html b/index.html index 82589cf..0d315da 100644 --- a/index.html +++ b/index.html @@ -111,11 +111,11 @@

Example

 # Show the cell indices
-draw_matrix(mat_3x5, show_cell_indices = TRUE)
+draw_matrix(mat_3x5, show_indices = "cell")

-# Show the row and column indices
-draw_matrix(mat_3x5, show_row_indices = TRUE, show_column_indices = TRUE)
+# Show all indices +draw_matrix(mat_3x5, show_indices = "all")

 # Highlight cells over a specific value
@@ -128,7 +128,9 @@ 

Example

 # Highlight cells in specific columns
-gdraw_matrix(mat_3x5, highlight_area = highlight_columns(mat_3x5, columns = 2:4))
+gdraw_matrix(mat_3x5, + show_indices = c("row", "column"), + highlight_area = highlight_columns(mat_3x5, columns = 2:4))

diff --git a/pkgdown.yml b/pkgdown.yml index e54aa4f..c6c608d 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 2.19.2 pkgdown: 2.0.7 pkgdown_sha: ~ articles: {} -last_built: 2024-01-16T04:28Z +last_built: 2024-01-17T06:40Z urls: reference: http://r-pkg.thecoatlessprofessor.com/drawr/reference article: http://r-pkg.thecoatlessprofessor.com/drawr/articles diff --git a/reference/Rplot004.png b/reference/Rplot004.png index a4520e3..713e047 100644 Binary files a/reference/Rplot004.png and b/reference/Rplot004.png differ diff --git a/reference/Rplot005.png b/reference/Rplot005.png index 717dd91..5537e60 100644 Binary files a/reference/Rplot005.png and b/reference/Rplot005.png differ diff --git a/reference/Rplot006.png b/reference/Rplot006.png index 717dd91..5537e60 100644 Binary files a/reference/Rplot006.png and b/reference/Rplot006.png differ diff --git a/reference/Rplot007.png b/reference/Rplot007.png index 1d7db41..f53fc8b 100644 Binary files a/reference/Rplot007.png and b/reference/Rplot007.png differ diff --git a/reference/Rplot008.png b/reference/Rplot008.png index ad7ecf9..c131dac 100644 Binary files a/reference/Rplot008.png and b/reference/Rplot008.png differ diff --git a/reference/draw-matrix-1.png b/reference/draw-matrix-1.png index 61c7b5e..804d46f 100644 Binary files a/reference/draw-matrix-1.png and b/reference/draw-matrix-1.png differ diff --git a/reference/draw-matrix-2.png b/reference/draw-matrix-2.png index 4682077..29de953 100644 Binary files a/reference/draw-matrix-2.png and b/reference/draw-matrix-2.png differ diff --git a/reference/draw-matrix-3.png b/reference/draw-matrix-3.png index 884d119..a47f703 100644 Binary files a/reference/draw-matrix-3.png and b/reference/draw-matrix-3.png differ diff --git a/reference/draw-matrix-4.png b/reference/draw-matrix-4.png index 43d9e21..2e976ac 100644 Binary files a/reference/draw-matrix-4.png and b/reference/draw-matrix-4.png differ diff --git a/reference/draw-matrix-5.png b/reference/draw-matrix-5.png index b4f85f8..ac01fb1 100644 Binary files a/reference/draw-matrix-5.png and b/reference/draw-matrix-5.png differ diff --git a/reference/draw-matrix-6.png b/reference/draw-matrix-6.png index b4f85f8..ac01fb1 100644 Binary files a/reference/draw-matrix-6.png and b/reference/draw-matrix-6.png differ diff --git a/reference/draw-matrix-7.png b/reference/draw-matrix-7.png index 806e265..7b8f4de 100644 Binary files a/reference/draw-matrix-7.png and b/reference/draw-matrix-7.png differ diff --git a/reference/draw-matrix-8.png b/reference/draw-matrix-8.png index 18eacd4..86577eb 100644 Binary files a/reference/draw-matrix-8.png and b/reference/draw-matrix-8.png differ diff --git a/reference/draw-matrix.html b/reference/draw-matrix.html index b64a72e..12b2bd5 100644 --- a/reference/draw-matrix.html +++ b/reference/draw-matrix.html @@ -50,20 +50,22 @@

Usage

draw_matrix(
   data,
-  show_cell_indices = FALSE,
-  show_row_indices = FALSE,
-  show_column_indices = FALSE,
-  highlight_area = matrix(FALSE, nrow(data), ncol(data)),
-  highlight_color = "lemonchiffon"
+  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_cell_indices = FALSE,
-  show_row_indices = FALSE,
-  show_column_indices = FALSE,
+  show_indices = "none",
   highlight_area = matrix(FALSE, nrow(data), ncol(data)),
-  highlight_color = "lemonchiffon"
+  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 = ", "))
 )
@@ -73,16 +75,12 @@

Arguments: no indices, "cell": matrix cell indices [i, j], +"row": row indices [i, ] to the left of the matrix, +"column": column indices [,j] above matrix, and +"all": row, column, and inside options. Default: "none".

highlight_area
@@ -93,6 +91,15 @@

Arguments @@ -104,15 +111,16 @@

Examplesdraw_matrix(mat_3x3) -# Show the indices -draw_matrix(mat_3x3, show_cell_indices = TRUE) +# 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_row_indices = TRUE, highlight_area = highlight_rows(mat_4x4, rows = 1)) + mat_4x4, show_indices = "row", + highlight_area = highlight_rows(mat_4x4, rows = 1) +) # Highlight values above 5 diff --git a/reference/draw-vector-1.png b/reference/draw-vector-1.png index 7cf86fd..37cfdfb 100644 Binary files a/reference/draw-vector-1.png and b/reference/draw-vector-1.png differ diff --git a/reference/figures/README-base-example-1.png b/reference/figures/README-base-example-1.png index f7608b8..3f021be 100644 Binary files a/reference/figures/README-base-example-1.png and b/reference/figures/README-base-example-1.png differ diff --git a/reference/figures/README-base-example-2.png b/reference/figures/README-base-example-2.png index 820e39a..39a514a 100644 Binary files a/reference/figures/README-base-example-2.png and b/reference/figures/README-base-example-2.png differ diff --git a/reference/figures/README-base-example-3.png b/reference/figures/README-base-example-3.png index c9e1dea..7c9b0a7 100644 Binary files a/reference/figures/README-base-example-3.png and b/reference/figures/README-base-example-3.png differ diff --git a/reference/figures/README-base-example-4.png b/reference/figures/README-base-example-4.png index ed77ff7..4037292 100644 Binary files a/reference/figures/README-base-example-4.png and b/reference/figures/README-base-example-4.png differ diff --git a/reference/figures/README-ggplot2-example-1.png b/reference/figures/README-ggplot2-example-1.png index 62bc205..ee654df 100644 Binary files a/reference/figures/README-ggplot2-example-1.png and b/reference/figures/README-ggplot2-example-1.png differ diff --git a/reference/figures/README-ggplot2-example-2.png b/reference/figures/README-ggplot2-example-2.png index a3e64ea..c3ae3a5 100644 Binary files a/reference/figures/README-ggplot2-example-2.png and b/reference/figures/README-ggplot2-example-2.png differ diff --git a/search.json b/search.json index d9d0a7d..b04bc03 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_cell_indices = TRUE) # Show the row and column indices draw_matrix(mat_3x5, show_row_indices = TRUE, show_column_indices = TRUE) # 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, 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_cell_indices = FALSE, show_row_indices = FALSE, show_column_indices = FALSE, highlight_area = matrix(FALSE, nrow(data), ncol(data)), highlight_color = \"lemonchiffon\" ) gdraw_matrix( data, show_cell_indices = FALSE, show_row_indices = FALSE, show_column_indices = FALSE, highlight_area = matrix(FALSE, nrow(data), ncol(data)), highlight_color = \"lemonchiffon\" )"},{"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_cell_indices Display cell indices inside matrix cell, e.g. [, j]. Default: FALSE show_row_indices Display row indices next matrix row, e.g. [, ]. Default: FALSE show_column_indices Display column indices next matrix column, e.g. [, j]. Default: FALSE highlight_area Matrix logical values provide mask cells filled. Default: None. highlight_color Color use fill background cell.","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 indices draw_matrix(mat_3x3, show_cell_indices = TRUE) # Highlight a row mat_4x4 = matrix(seq_len(16), nrow = 4) draw_matrix( mat_4x4, show_row_indices = TRUE, 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, 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"}]