Skip to contents

A cbind() method to merge gen_tibble objects with data.frames and normal tibbles. Whilst this works, it is not ideal as it does not check the order of the tables, and we suggest that you use dplyr::left_join() instead. Note that cbind will not combine two gen_tibbles (i.e. it will NOT combine markers for the same individuals)

Usage

# S3 method for class 'gen_tbl'
cbind(..., deparse.level = 1)

# S3 method for class 'grouped_gen_tbl'
cbind(..., deparse.level = 1)

Arguments

...

a gen_tibble and a data.frame or tibble

deparse.level

an integer controlling the construction of column names. See cbind for details.

Value

a gen_tibble

Details

As in dplyr::bind_cols() (which dplyr uses to cbind() grouped tibbles), duplicated column names are made unique (e.g. population...2 and population...4), with a message. If a grouping variable is renamed, the result is no longer grouped. The columns id and genotypes of the gen_tibble can not be duplicated, as renaming them would break it.

Examples

example_gt <- load_example_gt("gen_tbl")

# Create a dataframe to combine with the gen_tibble
df <- data.frame(region = c("A", "A", "B", "B", "A", "B", "B"))

# Combine the gen_tibble with the dataframe
example_gt <- cbind(example_gt, df)