Description Usage Arguments Details Value Author(s) See Also Examples

Given a numeric vector, these functions compute and return the few
smallest elements in it. The number of elements returned is specified as
either a definite number (`k`

) or as a proportion of the vector
length (`p`

). The variant functions (`which.*`

), accomplish
the same task, but return instead the position of such elements in the vector.

1 2 3 4 | ```
least.k(x, k)
least.p(x, p)
which.least.k(x, k)
which.least.p(x, p)
``` |

`x` |
The numeric vector. |

`k` |
The number of smallest elements sought. |

`p` |
The number of smallest elements sought, specified as proportion of the length of |

These functions are used internally in the determination of nearest neighbours; the user need not call any of these functions directly. Rather, the choice is specified via the arguments `k`

and `p`

.

Either the smallest values themselves or, for the which.* functions, their positions in the vector.

Mohit Dayal

get.NN

1 2 3 4 5 | ```
x <- rnorm(10)
least.k(x, 3)
least.p(x, 0.3)
which.least.k(x, 3)
which.least.p(x, 0.3)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.