-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add create_status_cols function (#22)
* Add create_status_cols function - Functionalized initialization of sawmill_pass and sawmill_status columns in timber at the start of the check_grain function - Added to-do notes for build_chairs function - Updated .gitignore to include .DS_Store * Recover validate_contingency_table - Added missing lines of code for validate_contingency_table function
- Loading branch information
1 parent
6fa0bdf
commit 5a2e90d
Showing
9 changed files
with
135 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.RData | ||
.Rproj.user | ||
/ignored | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
|
||
#' @title | ||
#' Initializes the `sawmill_status` and `sawmill_pass` columns at the start | ||
#' of the \code{check_grain()} function | ||
#' | ||
#' @description | ||
#' \code{create_status_cols()} adds columns to the passed tibble, containing | ||
#' the sawmill status provided. | ||
#' | ||
#' @param timber | ||
#' A tibble of timber, with a table built by \code{\link{build_table}}. | ||
#' | ||
#' @param status | ||
#' A sawmill status description. | ||
#' | ||
#' @details | ||
#' The \code{create_status_cols()} function works by initializing the default | ||
#' sawmill status as specified in the \code{check_grain()} function. | ||
#' The `sawmill_pass` column indicates whether sawmill should operate on the | ||
#' resistance outcome. Set `sawmill_pass = FALSE` after other co-occurring | ||
#' events during check failure. | ||
#' | ||
#' @return | ||
#' The passed tibble of timber with additional columns containing the current | ||
#' sawmill status. | ||
#' | ||
#' | ||
#' @export | ||
|
||
create_status_cols <- function(timber, status = "Initialized.") { | ||
# Column 'sawmill_pass' indicates whether sawmill should operate on the | ||
# resistance outcome. Set 'sawmill_pass = FALSE' after other co-occurring | ||
# events during check failure. | ||
if (!('sawmill_pass' %in% names(timber))) { | ||
timber[ , 'sawmill_pass'] <- TRUE | ||
message("Column 'sawmill_pass' did not exist and was created.") | ||
} | ||
|
||
# Column 'sawmill_status' indicates the current sawmill status. | ||
# Set 'sawmill_status' after every sawmill operation. | ||
if (!('sawmill_status' %in% names(timber))) { | ||
# Default status | ||
timber[ , 'sawmill_status'] <- status | ||
message("Column 'sawmill_status' did not exist and was created.") | ||
} | ||
|
||
return(timber) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.