match_id_ | R Documentation |
Match IDs in a vector to a reference table and then take other columns from that reference table and output them as a list of vectors. 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_( to_match, ref, match, new, regex = "[^;]+", collapse = ";", simplify = FALSE, verbose = FALSE )
to_match |
|
ref |
|
match |
|
new |
|
regex |
|
collapse |
|
simplify |
|
verbose |
|
Returns a list of named vectors unless simplify = TRUE
wherein a
named vector is returned.
match_id()
which takes a data.frame as 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_vec <- c("AAA111", "CCC333;BBB222", "EEE555") my_df2 <- match_id_( my_vec, ref_df, "accession", c("name", "value") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.