-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5debdf8
commit bd8ac31
Showing
5 changed files
with
88 additions
and
8 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: qSIP2 | ||
Title: qSIP Analysis | ||
Version: 0.4.0.9007 | ||
Version: 0.4.0.9008 | ||
Authors@R: | ||
person("Jeff", "Kimbrel", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "YOUR-ORCID-ID")) | ||
|
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,31 @@ | ||
#' Add gradient_pos_rel_amt to data | ||
#' | ||
#' This function will calculate the relative amt of a fraction compared to the | ||
#' whole replicate using either qPCR copies or DNA concentrations. | ||
#' | ||
#' @param data A dataframe or tibble | ||
#' @param source_mat_id Grouping variable for a replicate | ||
#' @param amt Column name that has the qPCR or DNA amounts per fraction | ||
#' @param overwrite Determines whether or not to overwrite an existing gradient_pos_rel_amt column | ||
#' | ||
#' @export | ||
#' | ||
#' @keywords sample_data | ||
|
||
add_gradient_pos_rel_amt = function(data, | ||
source_mat_id = "source_mat_id", | ||
amt, | ||
overwrite = F) { | ||
|
||
if ("gradient_pos_rel_amt" %in% colnames(data)) { | ||
if (overwrite == FALSE) { | ||
stop("gradient_pos_rel_amt already exists! Set overwrite = TRUE if you want to overwrite") | ||
} else if (overwrite == TRUE) { | ||
message("gradient_pos_rel_amt already exists and will be overwritten") | ||
} | ||
} | ||
|
||
data |> | ||
dplyr::mutate(gradient_pos_rel_amt = !!as.name(amt) / sum(!!as.name(amt)), | ||
.by = !!as.name(source_mat_id)) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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