Skip to content

Commit

Permalink
Add a function to create a first row in natural order (#30)
Browse files Browse the repository at this point in the history
* Documentation fix.

* Add a function to create a first row in natural order.
  • Loading branch information
MHenderson authored May 29, 2024
1 parent 5d6b598 commit 121730a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: keedwell
Title: Latin Squares in R
Version: 0.1.1.9002
Version: 0.1.1.9003
Authors@R:
person("Matthew", "Henderson", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7949-8208"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

export(add_cols)
export(add_rows)
export(first_row_natural)
2 changes: 1 addition & 1 deletion R/add-rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @param rows empty rows to be filled
#' @param strategy row filling strategy
#'
#' @return
#' @return A latin rectangle
#' @export
add_rows <- function(R, rows, strategy = next_row_matching) {

Expand Down
10 changes: 10 additions & 0 deletions R/first-row.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#' First row in in natural order
#'
#' @param n Number of columns
#'
#' @return A 1 x n latin rectangle with first row 1,...,n
#' @export
first_row_natural <- function(n) {
tidyr::expand_grid(row = 1:1, column = 1:n) |>
dplyr::mutate(symbol = 1:n)
}
3 changes: 3 additions & 0 deletions man/add_rows.Rd

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

17 changes: 17 additions & 0 deletions man/first_row_natural.Rd

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

0 comments on commit 121730a

Please sign in to comment.