| match_id | R Documentation |
Match IDs in a data.frame/tibble to a reference table and then take other columns from that reference table and bind them to the original data.frame. I mainly use this for matching metadata to UniProt accessions, but will work for any type of string ID e.g. Ensembl IDs.
match_id( data, to_match, ref, match, new, regex = "[^;]+", collapse = ";", verbose = FALSE )
data |
|
to_match |
|
ref |
|
match |
|
new |
|
regex |
|
collapse |
|
verbose |
|
Returns a transformed data.frame or tibble.
match_id_() which takes a vector input instead.
ref_df <- data.frame(
accession = c("AAA111", "BBB222", "CCC333", "DDD444"),
name = c("protein a", "protein b", "protein c", "protein d"),
value = c(11, 22, 33, 44)
)
my_df <- data.frame(
uniprot.id = c("AAA111", "CCC333;BBB222", "EEE555"),
r1 = c(1, 23, 5),
r2 = c(1, 23, 5),
r3 = c(1, 23, 5)
)
my_df2 <- match_id(
my_df,
uniprot.id,
ref_df,
"accession",
c("name", "value")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.