From c858464443ea1aa1bcd4e785de50af7580d01fba Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Wed, 28 Sep 2022 17:40:53 -0700 Subject: [PATCH 1/8] Add NEWS.md --- NEWS.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 NEWS.md 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 From 6dca28d05d299ad3d731296e5702d85ce369b807 Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Wed, 28 Sep 2022 17:41:12 -0700 Subject: [PATCH 2/8] rerun documentation post spelling --- R/gg_record.R | 2 +- R/magick-resize.R | 2 +- man/Recording.Rd | 2 +- vignettes/camcorder_view.Rmd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/gg_record.R b/R/gg_record.R index d4867fc..4d8ac6e 100644 --- a/R/gg_record.R +++ b/R/gg_record.R @@ -107,7 +107,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? 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/man/Recording.Rd b/man/Recording.Rd index b4acb36..74a0501 100644 --- a/man/Recording.Rd +++ b/man/Recording.Rd @@ -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} 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()` From bcd9873592c0964484d0fe553bf76c69fe8aa883 Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Wed, 28 Sep 2022 17:43:50 -0700 Subject: [PATCH 3/8] add cran-comments --- .Rbuildignore | 1 + cran-comments.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 cran-comments.md diff --git a/.Rbuildignore b/.Rbuildignore index cebf2a1..94ba4da 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,4 @@ README.Rmd ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^cran-comments\.md$ diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..72e36da --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,15 @@ +## 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 From 8e4cea073cae9fa400f80199f821ccb8fe5c42ec Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Wed, 28 Sep 2022 17:45:54 -0700 Subject: [PATCH 4/8] Adding CRAN-SUBMISSION --- .Rbuildignore | 1 + CRAN-SUBMISSION | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 CRAN-SUBMISSION diff --git a/.Rbuildignore b/.Rbuildignore index 94ba4da..2ea8fbf 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ README.Rmd ^docs$ ^pkgdown$ ^cran-comments\.md$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..2dbe937 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.1.0 +Date: 2022-09-29 00:45:15 UTC +SHA: bcd9873592c0964484d0fe553bf76c69fe8aa883 From 1f42b0f5c5745f5d3c2b8c3f95edce2abc811c61 Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Thu, 29 Sep 2022 09:09:59 -0700 Subject: [PATCH 5/8] set large gifs to be ignored from build - only used in the Rmd --- .Rbuildignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.Rbuildignore b/.Rbuildignore index 2ea8fbf..90c0bfa 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,6 @@ README.Rmd ^pkgdown$ ^cran-comments\.md$ ^CRAN-SUBMISSION$ +man/figures/cscherer_coffee_ratings\.gif +man/figures/gkaramanis_tour_de_france\.gif +man/figures/vignette_gif\.gif From e22ad295f8a6e8bf5db582a449e55005a6a2a78a Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Thu, 29 Sep 2022 09:16:03 -0700 Subject: [PATCH 6/8] update cran comments and description orcid --- DESCRIPTION | 3 ++- cran-comments.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5a62538..b9e2881 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", diff --git a/cran-comments.md b/cran-comments.md index 72e36da..c50b911 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -13,3 +13,7 @@ ## 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 From 889582e2e66d37cdbf760751ae57a6cffa1d702a Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Sun, 2 Oct 2022 01:15:56 -0700 Subject: [PATCH 7/8] Address feedback from CRAN, second attempt --- CRAN-SUBMISSION | 4 ++-- DESCRIPTION | 6 +++++- R/gg_record.R | 11 +++++------ R/recording.R | 3 +++ cran-comments.md | 2 ++ man/Recording.Rd | 7 ++++--- man/record_polaroid.Rd | 4 ++++ tests/testthat/test-recording.R | 2 ++ 8 files changed, 27 insertions(+), 12 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 2dbe937..8cb6e46 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 0.1.0 -Date: 2022-09-29 00:45:15 UTC -SHA: bcd9873592c0964484d0fe553bf76c69fe8aa883 +Date: 2022-09-29 16:16:36 UTC +SHA: e22ad295f8a6e8bf5db582a449e55005a6a2a78a diff --git a/DESCRIPTION b/DESCRIPTION index b9e2881..bc4ab34 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,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/R/gg_record.R b/R/gg_record.R index 4d8ac6e..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. @@ -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/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 index c50b911..5fb70b1 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -17,3 +17,5 @@ There are currently no downstream dependencies on this package as it is the firs ## 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 74a0501..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".} @@ -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)){ From 64f80401cdec9932b41bbaf89533b4da5cd4c76b Mon Sep 17 00:00:00 2001 From: thebioengineer Date: Mon, 3 Oct 2022 06:33:17 -0700 Subject: [PATCH 8/8] successful submission to CRAN --- CRAN-SUBMISSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 8cb6e46..ad1849d 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 0.1.0 -Date: 2022-09-29 16:16:36 UTC -SHA: e22ad295f8a6e8bf5db582a449e55005a6a2a78a +Date: 2022-10-02 08:18:54 UTC +SHA: 889582e2e66d37cdbf760751ae57a6cffa1d702a