Skip to content

Commit

Permalink
Document cycle (#46)
Browse files Browse the repository at this point in the history
* Document the cycle function.

* Minor clarification for the rot documentation.
  • Loading branch information
MHenderson authored Mar 31, 2024
1 parent a7f4504 commit ad2c468
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
12 changes: 9 additions & 3 deletions R/cycle.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#' Cycle
#' Create a 2 by 2 grid pattern of rotated pictures
#'
#' @param p A grob
#' @return A grob
#' `cycle` returns a 2 by 2 grid pattern of four pictures, each obtained from
#' the input `grid::grob` picture `p`. In the top left position of the grid
#' is `p`, in the bottom-right position is the picture `p` rotated by 90 degrees.
#' In the bottom-left position `p` is rotated through 180 degrees and in the
#' top-right position `p` is rotated through 270 degrees.
#'
#' @param p A `grid::grob` for the top-left position
#' @return A `grid::grob` made up of rotations of the four input pictures arranged in a 2 by 2 grid pattern.
#' @export
cycle <- function(p) {
return(quartet(p, rot(rot(rot(p))), rot(p), rot(rot(p))))
Expand Down
4 changes: 2 additions & 2 deletions R/rot.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Rotate a picture
#'
#' `rot` returns a new picture, made by rotating the input picture. If no angle
#' is specified then the new picture will be rotated 90 degrees. A different
#' angle can be specified with the `angle` argument.
#' is specified then the new picture will be rotated clockwise by 90 degrees. A
#' different angle can be specified with the `angle` argument.
#'
#' @param g A `grid::grob` picture
#' @param angle An angle
Expand Down
12 changes: 8 additions & 4 deletions man/cycle.Rd

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

4 changes: 2 additions & 2 deletions man/rot.Rd

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

0 comments on commit ad2c468

Please sign in to comment.