From 178c122bedc5edbda3a3150573a11551ff19056b Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Mon, 15 Jan 2024 03:08:24 -0800 Subject: [PATCH] Add more documentation for vector --- R/vector.R | 9 ++++++++- man/draw-vector.Rd | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/R/vector.R b/R/vector.R index eb87ef9..8954fed 100644 --- a/R/vector.R +++ b/R/vector.R @@ -21,9 +21,16 @@ #' @examples #' # Base graphics #' -#' # Visualize a 3x3 +#' # Visualize a nine element vector #' vec_9 <- round(rnorm(5, 0, 4), 2) #' draw_vector(vec_9) +#' +#' # 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)) draw_vector <- function( data, layout = c("vertical", "horizontal"), diff --git a/man/draw-vector.Rd b/man/draw-vector.Rd index b8af817..eed8796 100644 --- a/man/draw-vector.Rd +++ b/man/draw-vector.Rd @@ -39,7 +39,14 @@ Generate a graph showing the contents of a Vector \examples{ # Base graphics -# Visualize a 3x3 +# Visualize a nine element vector vec_9 <- round(rnorm(5, 0, 4), 2) draw_vector(vec_9) + +# 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)) }