feat: random_ggplot('ts'), random_mock(), random_text(var=) — issues #4 #1 #3#16
feat: random_ggplot('ts'), random_mock(), random_text(var=) — issues #4 #1 #3#16VincentGuyader wants to merge 10 commits into
Conversation
Addresses pr-reviewer nits on #16: explicit heights guard with tests, and distinct wrapping default labels via random_text(var = i).
|
CI status: The only red check is Ready for review. |
There was a problem hiding this comment.
Pull request overview
Adds new prototyping helpers and improves existing generators in {shinipsum}: time-series ggplots, UI “zoning” mocks for Shiny layouts, and deterministic text variants for repeated placeholder text use.
Changes:
- Extend
random_ggplot()with a new"ts"/"timeseries"type and include it in the random pool; also remove ggplot2size→linewidthdeprecation warning for the"line"type. - Add new exported
random_mock()to generate a bootstrap-row mock UI layout as a self-containedhtmltools::tagList(). - Extend
random_text()with avarargument for repeatable “variant” slices of the lorem corpus, plus new tests and documentation updates.
Reviewed changes
Copilot reviewed 13 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
R/Plot.R |
Adds "ts" time-series ggplot variants, alias handling, and updates geom_line() to use linewidth. |
R/Text.R |
Adds var argument with validation and variant/wrapping logic for both char- and word-based outputs. |
R/Mock.R |
Introduces random_mock() and internal CSS helper for Shiny UI layout zoning. |
R/globals.R |
Extends globalVariables() to cover new NSE columns used by the "ts" plots. |
tests/testthat/test-ggplot-ts.R |
Adds tests for "ts"/"timeseries" behavior, Date x-axis, no-build-warnings, and pool inclusion. |
tests/testthat/test-ggplot.R |
Adds deterministic random_ggplotly() coverage test using non-optional plot types. |
tests/testthat/test-mock.R |
Adds tests for random_mock() output structure, recycling, auto labels, and input validation. |
tests/testthat/test-text-var.R |
Adds tests for random_text(var=) backward compatibility, variation, wrapping, and validation. |
DESCRIPTION |
Adds htmltools to Imports; adds MASS/hexbin to Suggests; updates RoxygenNote. |
NAMESPACE |
Exports random_mock; imports new symbols from attempt, ggplot2, and htmltools. |
NEWS.md |
Documents the new features and the ggplot2 deprecation warning fix. |
man/random_ggplot.Rd |
Updates docs to include "ts" and its behavior. |
man/random_text.Rd |
Updates docs to include the new var argument. |
man/random_mock.Rd |
Adds documentation for the new random_mock() function. |
man/shinipsum-package.Rd |
Minor formatting adjustment in package description. |
.Rbuildignore |
Adds dev/ to build ignore patterns. |
dev/SUIVI_AUTONOME.md |
Adds internal development tracking notes for the implemented issues. |
Files not reviewed (4)
- man/random_ggplot.Rd: Language not supported
- man/random_mock.Rd: Language not supported
- man/random_text.Rd: Language not supported
- man/shinipsum-package.Rd: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -21,18 +26,38 @@ random_text <- function(nchars = NULL, nwords = NULL, offset=0){ | |||
| ~ !is.null(.x), | |||
| "You can't chose both nchars and nwords" | |||
| } else { | ||
| n <- length(shinipsum::lorem_words) | ||
| shift <- (var - 1L) * nwords | ||
| idx <- ((1 + offset:nwords + offset + shift) - 1L) %% n + 1L |
| @@ -18,7 +18,10 @@ random_ggplot <- function(type = c("random", "point", "bar", | |||
| "density", "density_2d", "dotplot", | |||
| "hex", "freqpoly", "histogram", | |||
| "ribbon", "raster", "tile", | |||
- typo 'chose' -> 'choose' in random_text() error message - rewrite random_text() var>1 word-indexing without ambiguous +/: precedence - de-duplicate 'tile' in random_ggplot() type choices (was biasing the random pool) + add a no-duplicates test
|
Thanks @copilot — all three points addressed in dce10a3:
Re: the red |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 17 changed files in this pull request and generated 4 comments.
Files not reviewed (4)
- man/random_ggplot.Rd: Language not supported
- man/random_mock.Rd: Language not supported
- man/random_text.Rd: Language not supported
- man/shinipsum-package.Rd: Language not supported
| random_ggplot <- function(type = c("random", "point", "bar", | ||
| "boxplot","col", "tile", | ||
| "line", "bin2d", "contour", | ||
| "density", "density_2d", "dotplot", | ||
| "hex", "freqpoly", "histogram", | ||
| "ribbon", "raster", "tile", | ||
| "violin")) { | ||
| "ribbon", "raster", | ||
| "violin", "ts")) { |
| "ribbon" = sample(140:141, 1), | ||
| "raster" = sample(150:151, 1), | ||
| "tile" = sample(160:161, 1), | ||
| "violin" = sample(170:171, 1) | ||
| "violin" = sample(170:171, 1), | ||
| "ts" = sample(180:182, 1) |
| stop_if_all( | ||
| list(nchars, nwords), | ||
| ~ !is.null(.x), | ||
| "You can't chose both nchars and nwords" | ||
| "You can't choose both nchars and nwords" | ||
| ) |
| the lorem-ipsum corpus on repeated calls (#3). | ||
| * Fixed a `ggplot2` deprecation warning in `random_ggplot("line")` | ||
| (`size` -> `linewidth`) (#13). | ||
| * Added a `NEWS.md` file to track changes to the package. |
- new type 'ts' (alias 'timeseries') with 3 Date-axis variants (economics unemploy/psavert, AirPassengers) - fix geom_line(size=) -> linewidth deprecation warning (#13) - add coverage for random_ggplotly() - TDD: tests/testthat/test-ggplot-ts.R written first (red), then implementation
- random_mock(widths, heights, labels) returns a htmltools::tagList of bordered bootstrap columns to sketch a Shiny UI zoning - new Imports: htmltools - declare psavert/passengers globals, ignore dev/ in build - TDD: tests/testthat/test-mock.R written first (red), then implementation
- random_text(..., var = N): var = 1 keeps the historical output, higher values return distinct (wrapping) slices of the lorem corpus - TDD: tests/testthat/test-text-var.R written first (red), then implementation
Addresses pr-reviewer nits on #16: explicit heights guard with tests, and distinct wrapping default labels via random_text(var = i).
… Suggests random_ggplotly() with no arg could build a density_2d/hex variant whose rendering needs MASS/hexbin, absent on minimal CI images. Pin the test to package-free geom types, and declare MASS + hexbin in Suggests so the density_2d / hex types of random_ggplot() work (also clears the --as-cran test ERROR).
- typo 'chose' -> 'choose' in random_text() error message - rewrite random_text() var>1 word-indexing without ambiguous +/: precedence - de-duplicate 'tile' in random_ggplot() type choices (was biasing the random pool) + add a no-duplicates test
dce10a3 to
81c4f58
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 17 changed files in this pull request and generated 3 comments.
Files not reviewed (4)
- man/random_ggplot.Rd: Language not supported
- man/random_mock.Rd: Language not supported
- man/random_text.Rd: Language not supported
- man/shinipsum-package.Rd: Language not supported
| } else { | ||
| n <- length(shinipsum::lorem_words) | ||
| start <- (offset + (var - 1L) * nwords) %% n | ||
| idx <- ((start + seq.int(0L, nwords)) %% n) + 1L |
| "histogram" = sample(130:131, 1), | ||
| "ribbon" = sample(140:141, 1), | ||
| "raster" = sample(150:151, 1), | ||
| "tile" = sample(160:161, 1), | ||
| "violin" = sample(170:171, 1) | ||
| "violin" = sample(170:171, 1), | ||
| "ts" = sample(180:182, 1) |
| the lorem-ipsum corpus on repeated calls (#3). | ||
| * Fixed a `ggplot2` deprecation warning in `random_ggplot("line")` | ||
| (`size` -> `linewidth`) (#13). | ||
| * Added a `NEWS.md` file to track changes to the package. |
|
Thanks @copilot — re-review handled in 3307c48:
CI is fully green (6/6, |
CI: green. |
Summary
random_ggplot()gains a"ts"type (alias"timeseries") returning a time-series oriented plot, with aDateon the x axis. 3 variants (economics$unemployline,AirPassengersline+point,economics$psavertarea)."ts"is part of the random pool.random_mock(widths, heights = 3, labels = NULL): builds a quick "zoning" of a Shiny UI as a row of bordered, labelled bootstrap columns, returned as a self-containedhtmltools::tagList(CSS<style>+ columns) droppable insidefluidPage()/bslib::page_fluid(). Default labels are short random lorem snippets.random_text()gains avarinteger argument:var = 1keeps the historical output byte-for-byte, higher values return distinct (wrapping) slices of the lorem corpus — useful for repeated calls in a list.random_ggplot("line")no longer triggers ggplot2'ssize → linewidthdeprecation warning. (Also addressed in PR #15; trivial to reconcile.)New dependency:
htmltoolsinImports(already a transitive dep via plotly / DT / dygraphs).Test plan (TDD, red first)
tests/testthat/test-ggplot-ts.R—"ts"/"timeseries"returns a ggplot whose data has aDatedatecolumn, build emits no warning,"ts"in the random pool.tests/testthat/test-mock.R— tagList of bootstrap columns, custom labels, recycling ofheights/labels, auto labels,widthsvalidation.tests/testthat/test-text-var.R—var = 1≡ historical behaviour, distinctvar⇒ distinct text, size preserved, largevarwraps (noNA), combines withoffset, validation.random_ggplotly()(previously uncovered).devtools::test(): 3398 PASS / 0 FAIL / 0 WARN.R CMD check --no-manual(tarball): 0 error / 0 warning / 1 note (utilsimport unused — pre-existing onmaster).R/Plot.R,R/Mock.R,R/Text.Rat 100%.Tracking notes in
dev/SUIVI_AUTONOME.md.Closes #1
Closes #3
Closes #4