From c2a0252d5a6f3e960e000e4d554ed17b63ed5b1c Mon Sep 17 00:00:00 2001 From: Matthew Henderson Date: Sun, 23 Jun 2024 14:07:18 +0100 Subject: [PATCH] Add empty_room function. (#20) --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/empty-room.R | 10 ++++++++++ man/empty_room.Rd | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 R/empty-room.R create mode 100644 man/empty_room.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 0d06e6a..d661fa7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: wallis Title: Room squares in R -Version: 0.0.0.9003 +Version: 0.0.0.9004 Authors@R: person("Matthew", "Henderson", , "matthew.james.henderson@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7949-8208")) diff --git a/NAMESPACE b/NAMESPACE index 5bde190..7965d7e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand export(empty_cells) +export(empty_room) export(n_filled_cells) export(plot_room_square) export(unused_pairs) diff --git a/R/empty-room.R b/R/empty-room.R new file mode 100644 index 0000000..56ef7f7 --- /dev/null +++ b/R/empty-room.R @@ -0,0 +1,10 @@ +#' Create a partial Room square with no filled cells +#' +#' @param n Size of partial Room square to create. +#' +#' @return A partial Room square of size n with no filled cells. +#' @export +empty_room <- function(n = 5) { + tidyr::expand_grid(row = 1:(n - 1), col = 1:(n - 1)) |> + dplyr::mutate(first = as.numeric(NA), second = as.numeric(NA)) +} \ No newline at end of file diff --git a/man/empty_room.Rd b/man/empty_room.Rd new file mode 100644 index 0000000..ea30294 --- /dev/null +++ b/man/empty_room.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/empty-room.R +\name{empty_room} +\alias{empty_room} +\title{Create a partial Room square with no filled cells} +\usage{ +empty_room(n = 5) +} +\arguments{ +\item{n}{Size of partial Room square to create.} +} +\value{ +A partial Room square of size n with no filled cells. +} +\description{ +Create a partial Room square with no filled cells +}