knn_dist.factor: K-Nearest Neighbors Distance for Factor Vectors

View source: R/knn_c.R

knn_dist.factorR Documentation

K-Nearest Neighbors Distance for Factor Vectors

Description

Computes the distance between two factor vectors by converting them to character vectors.

Usage

## S3 method for class 'factor'
knn_dist(x, y)

Arguments

x

A factor vector.

y

A factor vector.

Details

This method first converts the factors to character vectors and then computes distances using stringdist::stringdist.

Value

A numeric vector of distances between the elements of x and y, calculated using stringdist::stringdist on their character representations.


COHHIO/hud.export documentation built on Sept. 6, 2024, 1:48 a.m.