Skip to content

Commit

Permalink
add note + examples for downsampling data for plotting - see #32.
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed Mar 20, 2018
1 parent b3b44a4 commit 8d7bc02
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
20 changes: 20 additions & 0 deletions R/vis_dat.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
#'
#' @seealso [vis_miss()]
#'
#' @note Some datasets might be too large to plot, sometimes creating a blank
#' plot - if this happens, I would recommend downsampling the data, either
#' looking at the first 1,000 rows or by taking a random sample. This means
#' that you won't get the same "look" at the data, but it is better than
#' a blank plot! See example code for suggestions on doing this.
#'
#' @examples
#'
#' vis_dat(airquality)
Expand All @@ -34,6 +40,20 @@
#' vis_dat(airquality, palette = "cb_safe")
#' vis_dat(airquality, palette = "qual")
#'
#' \dontrun{
#' # if you have a large dataset, you might want to try downsampling:
#' library(nycflight13)
#' library(dplyr)
#' flights %>%
#' sample_n(1000) %>%
#' vis_dat()
#'
#' flights %>%
#' slice(1:1000) %>%
#' vis_dat()
#'
#' }
#'
#' @export
vis_dat <- function(x,
sort_type = TRUE,
Expand Down
20 changes: 20 additions & 0 deletions R/vis_miss.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#'
#' @seealso [vis_dat()]
#'
#' @note Some datasets might be too large to plot, sometimes creating a blank
#' plot - if this happens, I would recommend downsampling the data, either
#' looking at the first 1,000 rows or by taking a random sample. This means
#' that you won't get the same "look" at the data, but it is better than
#' a blank plot! See example code for suggestions on doing this.
#'
#' @examples
#'
#' vis_miss(airquality)
Expand All @@ -36,6 +42,20 @@
#'
#' vis_miss(airquality, sort_miss = TRUE)
#'
#' #' \dontrun{
#' # if you have a large dataset, you might want to try downsampling:
#' library(nycflight13)
#' library(dplyr)
#' flights %>%
#' sample_n(1000) %>%
#' vis_miss()
#'
#' flights %>%
#' slice(1:1000) %>%
#' vis_miss()
#'
#' }
#'
#' @export
vis_miss <- function(x,
cluster = FALSE,
Expand Down
21 changes: 21 additions & 0 deletions man/vis_dat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/vis_miss.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d7bc02

Please sign in to comment.