cosine_spectra: Pairwise cosine similarity scores

View source: R/cosine_spectra.R

cosine_spectraR Documentation

Pairwise cosine similarity scores

Description

Takes two spectra in tibble form, calculates their cosine similarity score.

Usage

cosine_spectra(spec_1, spec_2, thres_pks = 2, x = "mz")

Arguments

spec_1

Spectrum 1 in tibble form, with x-axis named as passed

spec_2

Spectrum 2 in tibble form, with x-axis named as passed

thres_pks

Minimum number of matching peaks, else return 0

x

Name of x-coordinate column (e.g. mz or wl)

Value

cosine similarity score of the two spectra (dbl)

Examples

cos <- cosine_spectra(ions %>% filter(scan == 114), ions %>% filter(scan == 114))
> 0.94


octopode/tidychrom documentation built on Nov. 2, 2022, 1:32 a.m.