Description Usage Arguments Examples
This function allows you to calculate the euclidean distance between two vectors
1 |
data |
A data frame |
var1 |
Numeric vector (generally f1). |
var2 |
Numeric vectors (generally f2). |
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Create some data
df <- data.frame(vowel = gl(n = 2, k = 5, labels = c('a', 'o')),
var1 = rnorm(10, 10, 2),
var2 = rnorm(10, 20, 2))
# Calculate euc.dist on entire data frame
euc_dist(data = df, var1 = var1, var2 = var2)
# Calculate euc.dist for each vowel
library(dplyr)
df %>%
group_by(., vowel) %>%
summarise(euc = euc_dist(., var1 = var1, var2 = var2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.