Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to create a first row in natural order #30

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.