diff --git a/.Rbuildignore b/.Rbuildignore index cebf2a1..90c0bfa 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,8 @@ README.Rmd ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^cran-comments\.md$ +^CRAN-SUBMISSION$ +man/figures/cscherer_coffee_ratings\.gif +man/figures/gkaramanis_tour_de_france\.gif +man/figures/vignette_gif\.gif diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..ad1849d --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.1.0 +Date: 2022-10-02 08:18:54 UTC +SHA: 889582e2e66d37cdbf760751ae57a6cffa1d702a diff --git a/DESCRIPTION b/DESCRIPTION index 5a62538..bc4ab34 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,8 @@ Authors@R: given = "Ellis", family = "Hughes", email = "ellishughes@live.com", - role = c("aut", "cre") + role = c("aut", "cre"), + comment = c(ORCID = "0000-0003-0637-4436") ), person( given = "Cédric", @@ -23,7 +24,11 @@ Authors@R: role = c("ctb") ) ) -Description: Record and generate a gif of your R sessions plots. +Description: Record and generate a 'gif' of your 'R' sessions plots. When creating + a visualization, there is inevitably iteration and refinement that occurs. + Automatically save the plots made to a specified directory, previewing them + as they would be saved. Then combine all plots generated into a 'gif' + to show the plot refinement over time. License: MIT + file LICENSE Encoding: UTF-8 LazyData: true diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..8a4dbcc --- /dev/null +++ b/NEWS.md @@ -0,0 +1,8 @@ +# camcorder 0.1.0 + +* Added a `NEWS.md` file to track changes to the package. +* Most of the functionality of the R package has been developed including: + - Capturing ggplot2/patchwork plots automatically + - Capturing other graphic outputs with record_polaroid() +* Preview outputs in the viewer as they are saved +* Generate a GIF of the history of recorded tables diff --git a/R/gg_record.R b/R/gg_record.R index d4867fc..6484fd3 100644 --- a/R/gg_record.R +++ b/R/gg_record.R @@ -1,11 +1,12 @@ #' @title Record and generate plot histories #' -#' @description Record plots created over time and generate a gif of the plots -#' made in the R session. +#' @description Record plots created over time and generate a GIF of the plots +#' made in the 'R' session. Overrides the print methods for ggplot and patchwork objects +#' from the 'ggplot2' and 'patchwork' packages respectively. #' #' @rdname Recording #' -#' @param dir directory to save the intermediate plots in +#' @param dir directory to save the intermediate plots in. Defaults to a temporary directory #' @param device Device to use. Can either be a device function (e.g. png()), or #' one of "png", "pdf", "jpeg", "bmp", "tiff", "emf", "svg", "eps", "ps". #' @param device_ext file extension to use for images created. Does not usually need to be populated manually. @@ -107,7 +108,7 @@ gg_record <- function(dir = NULL, #' @param frame_duration n seconds each plot should be shown #' @param image_resize size to rescale images to in pixels #' @param background color to set the background of the gif. A valid color string such as "navyblue" or -#' "#000080". Use "none" for transparancy. Does not impact the background of images. +#' "#000080". Use "none" for transparency. Does not impact the background of images. #' @param playback Boolean, should the recording start playing after it is #' turned into a gif? defaults to TRUE #' @param stoprecording Boolean, should the plots stop being recorded? @@ -165,9 +166,7 @@ gg_playback <- if (is.null(name)) { recording <- paste0(format(Sys.time(), "%Y_%m_%d_%H_%M_%S"), ".gif") - if (!GG_RECORDING_ENV$is_temp_dir) { - recording <- file.path(GG_RECORDING_ENV$recording_dir, recording) - } + recording <- file.path(GG_RECORDING_ENV$recording_dir, recording) } else{ recording <- name } diff --git a/R/magick-resize.R b/R/magick-resize.R index c34affa..56a2a5f 100644 --- a/R/magick-resize.R +++ b/R/magick-resize.R @@ -8,7 +8,7 @@ #' @param output path to save resized image #' @param max_size set maximum height/width of the image in pixels #' @param background color to set the background. A valid color string such as "navyblue" or -#' "#000080". Use "none" for transparancy. +#' "#000080". Use "none" for transparency. #' @return Nothing. Used to resize images on the file system. #' #' @importFrom magick image_read image_info image_resize image_extent image_write diff --git a/R/recording.R b/R/recording.R index 03219c5..0fec4b0 100644 --- a/R/recording.R +++ b/R/recording.R @@ -95,6 +95,9 @@ record_patchwork <- function(x,...) { #' function to capture what has been printed to the current graphics device and #' save it using the current camcorder settings #' +#' @returns No return value. Used for the side effect of capturing the current +#' graphics device and saving it to the set directory from gg_record. +#' #' @examples #' #' library(grid) diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..5fb70b1 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,21 @@ +## Test environments +* local R installation, R 4.2.1 +* ubuntu 18.04 (on github actions), R-release +* mac OS (on github actions) R-devel, R-release, +* win-builder (devel) + +## Local R CMD check results + +0 errors ✔ | 0 warnings ✔ | 0 notes ✔ + +* This is a new release. + +## Downstream dependencies + +There are currently no downstream dependencies on this package as it is the first CRAN submission + +## Notes + +Resubmission removing large gif files to make submission <5mb +Updates to documentation including adding the "value" param for record_polaroid, +and wrapping packages and API's in single quotes. diff --git a/man/Recording.Rd b/man/Recording.Rd index b4acb36..f3078d4 100644 --- a/man/Recording.Rd +++ b/man/Recording.Rd @@ -42,7 +42,7 @@ gg_resize_film(height = NA, width = NA, units = NA, dpi = NA) gg_stop_recording() } \arguments{ -\item{dir}{directory to save the intermediate plots in} +\item{dir}{directory to save the intermediate plots in. Defaults to a temporary directory} \item{device}{Device to use. Can either be a device function (e.g. png()), or one of "png", "pdf", "jpeg", "bmp", "tiff", "emf", "svg", "eps", "ps".} @@ -78,7 +78,7 @@ once, or a number to indicate how many times to repeat after the first.} \item{image_resize}{size to rescale images to in pixels} \item{background}{color to set the background of the gif. A valid color string such as "navyblue" or -"#000080". Use "none" for transparancy. Does not impact the background of images.} +"#000080". Use "none" for transparency. Does not impact the background of images.} \item{progress}{print some verbose status output} @@ -103,8 +103,9 @@ Returns the last plot generated, resized to new dimensions Returns nothing. used for side effect. } \description{ -Record plots created over time and generate a gif of the plots - made in the R session. +Record plots created over time and generate a GIF of the plots + made in the 'R' session. Overrides the print methods for ggplot and patchwork objects + from the 'ggplot2' and 'patchwork' packages respectively. resize the film for recording, reprints and saves last plot diff --git a/man/record_polaroid.Rd b/man/record_polaroid.Rd index f99630f..e730d3e 100644 --- a/man/record_polaroid.Rd +++ b/man/record_polaroid.Rd @@ -6,6 +6,10 @@ \usage{ record_polaroid() } +\value{ +No return value. Used for the side effect of capturing the current + graphics device and saving it to the set directory from gg_record. +} \description{ For plot types that don't have a special print method, use this function to capture what has been printed to the current graphics device and diff --git a/tests/testthat/test-recording.R b/tests/testthat/test-recording.R index a5f7957..25d8de6 100644 --- a/tests/testthat/test-recording.R +++ b/tests/testthat/test-recording.R @@ -143,6 +143,8 @@ test_that("recording works - gif output", { test_that("resizing a plot works", { + skip_on_cran() + rec_dir <- file.path(tempdir(),"camcorder_tests_resizing") if(dir.exists(rec_dir)){ diff --git a/vignettes/camcorder_view.Rmd b/vignettes/camcorder_view.Rmd index efbdcdc..5b4a245 100644 --- a/vignettes/camcorder_view.Rmd +++ b/vignettes/camcorder_view.Rmd @@ -24,7 +24,7 @@ options(rmarkdown.html_vignette.check_title = FALSE) There a other pretty cool features when recording your ggplot output with the `{camcorder}` that improve the workflow with `{ggplot2}`: 1. you don't need to run `ggsave()` every time after your `ggplot()` call -2. you can inspect the plot in the given dimensions **inside** Rstudio +2. you can inspect the plot in the given dimensions **inside** the RStudio IDE ## Omit Running and Typing `ggsave()`