mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 10:31:53 +02:00
replaced bactid by mo
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
#' @name join
|
||||
#' @aliases join inner_join
|
||||
#' @param x existing table to join, also supports character vectors
|
||||
#' @param by a variable to join by - could be a column name of \code{x} with values that exist in \code{microorganisms$bactid} (like \code{by = "bacteria_id"}), or another column in \code{\link{microorganisms}} (but then it should be named, like \code{by = c("my_genus_species" = "fullname")})
|
||||
#' @param by a variable to join by - could be a column name of \code{x} with values that exist in \code{microorganisms$mo} (like \code{by = "bacteria_id"}), or another column in \code{\link{microorganisms}} (but then it should be named, like \code{by = c("my_genus_species" = "fullname")})
|
||||
#' @param suffix if there are non-joined duplicate variables in \code{x} and \code{y}, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.
|
||||
#' @param ... other parameters to pass on to \code{dplyr::\link[dplyr]{join}}.
|
||||
#' @details As opposed to the \code{\link[dplyr]{join}} functions of \code{dplyr}, characters vectors are supported and at default existing columns will get a suffix \code{"2"} and the newly joined columns will not get a suffix. See \code{\link[dplyr]{join}} for more information.
|
||||
@ -25,9 +25,9 @@
|
||||
#' colnames(df)
|
||||
#' df2 <- left_join_microorganisms(df, "bacteria_id")
|
||||
#' colnames(df2)
|
||||
inner_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
|
||||
inner_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
|
||||
if (!any(class(x) %in% c("data.frame", "matrix"))) {
|
||||
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
|
||||
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
|
||||
}
|
||||
# no name set to `by` parameter
|
||||
if (is.null(names(by))) {
|
||||
@ -47,9 +47,9 @@ inner_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...
|
||||
|
||||
#' @rdname join
|
||||
#' @export
|
||||
left_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
|
||||
left_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
|
||||
if (!any(class(x) %in% c("data.frame", "matrix"))) {
|
||||
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
|
||||
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
|
||||
}
|
||||
# no name set to `by` parameter
|
||||
if (is.null(names(by))) {
|
||||
@ -69,9 +69,9 @@ left_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...)
|
||||
|
||||
#' @rdname join
|
||||
#' @export
|
||||
right_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
|
||||
right_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
|
||||
if (!any(class(x) %in% c("data.frame", "matrix"))) {
|
||||
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
|
||||
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
|
||||
}
|
||||
# no name set to `by` parameter
|
||||
if (is.null(names(by))) {
|
||||
@ -91,9 +91,9 @@ right_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...
|
||||
|
||||
#' @rdname join
|
||||
#' @export
|
||||
full_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
|
||||
full_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
|
||||
if (!any(class(x) %in% c("data.frame", "matrix"))) {
|
||||
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
|
||||
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
|
||||
}
|
||||
# no name set to `by` parameter
|
||||
if (is.null(names(by))) {
|
||||
@ -113,9 +113,9 @@ full_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...)
|
||||
|
||||
#' @rdname join
|
||||
#' @export
|
||||
semi_join_microorganisms <- function(x, by = 'bactid', ...) {
|
||||
semi_join_microorganisms <- function(x, by = 'mo', ...) {
|
||||
if (!any(class(x) %in% c("data.frame", "matrix"))) {
|
||||
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
|
||||
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
|
||||
}
|
||||
# no name set to `by` parameter
|
||||
if (is.null(names(by))) {
|
||||
@ -131,9 +131,9 @@ semi_join_microorganisms <- function(x, by = 'bactid', ...) {
|
||||
|
||||
#' @rdname join
|
||||
#' @export
|
||||
anti_join_microorganisms <- function(x, by = 'bactid', ...) {
|
||||
anti_join_microorganisms <- function(x, by = 'mo', ...) {
|
||||
if (!any(class(x) %in% c("data.frame", "matrix"))) {
|
||||
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
|
||||
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
|
||||
}
|
||||
# no name set to `by` parameter
|
||||
if (is.null(names(by))) {
|
||||
|
Reference in New Issue
Block a user