Description Usage Arguments Value Examples
Given a list, with an element per compound, cols
are the elements of the vector with which to calculate the cosine
similarity. cosine_pairs
will calculate the theta value between all
replicates for each possible pairing of compounds and return the result
in a long-format dataframe.
1 | cosine_pairs(x, cols)
|
x |
list, each element being a separate compound |
cols |
integer, column indices that match numeric data (e.g principal comonents) |
dataframe of compound combinations across replicates with a column of cosine similarity values
1 2 3 4 5 6 7 8 9 10 11 | cmpds <- c(rep('compound_1', 100),
rep('compound_2', 100),
rep('compound_3', 100))
replicate <- rep(1:100, 3)
PC1 <- rnorm(300)
PC2 <- rnorm(300)
df <- data.frame(cmpds, replicate, PC1, PC2)
df_split <- split(df, df$cmpds)
# works with unequal replicate sizes
df_split$a <- df_split$a[-c(1:10), ]
cosine_pairs(df_split, 3:4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.