cosine_pairs: Calculate pairs of cosine similarities between replicates

Description Usage Arguments Value Examples

Description

Given a list, with an element per compound, cols are the elements of the vector with which to calculate the cosine similarity

Usage

1
cosine_pairs(x, cols)

Arguments

x

list

cols

integer, column indices

Value

dataframe of compound combinations across replicates with a column of cosine similarity values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
cmpds <- c(rep('a', 100), rep('b', 100), rep('c', 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)

Swarchal/phenoDist documentation built on May 9, 2019, 3:25 p.m.