Skip to content

Commit

Permalink
Merge pull request #40 from thebioengineer/cran_comments_v0.1.0
Browse files Browse the repository at this point in the history
Submission to CRAN v0.1.0
  • Loading branch information
thebioengineer authored Oct 3, 2022
2 parents 5dd9f3b + 64f8040 commit 7ad6229
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 0.1.0
Date: 2022-10-02 08:18:54 UTC
SHA: 889582e2e66d37cdbf760751ae57a6cffa1d702a
9 changes: 7 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Authors@R:
given = "Ellis",
family = "Hughes",
email = "[email protected]",
role = c("aut", "cre")
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0637-4436")
),
person(
given = "Cédric",
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 6 additions & 7 deletions R/gg_record.R
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion R/magick-resize.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions R/recording.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 5 additions & 4 deletions man/Recording.Rd

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

4 changes: 4 additions & 0 deletions man/record_polaroid.Rd

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

2 changes: 2 additions & 0 deletions tests/testthat/test-recording.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down
2 changes: 1 addition & 1 deletion vignettes/camcorder_view.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down

0 comments on commit 7ad6229

Please sign in to comment.