A group of functions for miscellaneous usage.
dist_cos, dist_euc: cosine and Euclidean distance of 2 vectors.
return a single numeric value
get_mode, cv: get the mode and coefficient of variations of a vector.
return a single numeric value or multiple values when multi==TRUE
perm: permutation of 1:n sequence
consistSymbol: Force a integer vector to use numbers match best with another vector
strGrep: use a vector as the input of grep, return a list of the matching index for each item in the query vector.
gsub_multi: gsub a column of a df based on a list of criteria
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | dist_cos(a, b)
dist_euc(a, b)
get_mode(v, na.rm = TRUE, multi = FALSE)
cv(x)
perm(n)
consistSymbol(a, r)
strGrep(query, target, fixed = TRUE, vectorout = FALSE, ...)
gsub_multi(
df,
column = "Variant_Classification",
sub = list(Translation_Start_Site = c("De_novo_Start_InFrame",
"De_novo_Start_OutOfFrame", "Start_Codon_Del", "Start_Codon_SNP"), Frame_Shift_Indel
= c("Frame_Shift_Del", "Frame_Shift_Ins"), In_Frame_Indel = c("In_Frame_Ins",
"In_Frame_Del"))
)
|
a, b, x, r |
numeric vector. r for reference |
v |
any vector |
multi |
when TRUE, return a vector when multiple outcome are possible; when FALSE, only output the first one of them. |
n |
integer |
query, target |
vectors of the query and target for the grep |
vectorout |
if TRUE, the return the first match of each item in the query, thus the output is a vector, not a list. |
df |
dataframe |
column |
the column to be targeted by gsub |
sub |
the list with names as the replacement and the content as the matching items |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.