find_n_neighbors: Return n neighbors around given indices.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/util.R

Description

Return n neighbors around given indices.

Usage

1

Arguments

el

A numeric vector.

n

Number indicating how many points around the elements of el need to be selected.

max

The maximum value of the returned elements.

Value

A vector with the elements of x surrounded by n points.

Author(s)

Jacolien van Rij

See Also

Other Utility functions: findAbsMin(), firstLetterCap(), getArrowPos(), getDec(), getRange(), getRatioCoords(), get_palette(), group_sort(), inch2coords(), isColor(), list2str(), move_n_point(), orderBoxplot(), se(), sortGroups()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
vectorIndices <- 1:1000
indOutliers <- c(2,10, 473, 359, 717, 519)
fn3 <- find_n_neighbors(indOutliers, n=3, max=max(vectorIndices))
fn20 <- find_n_neighbors(indOutliers, n=20, max=max(vectorIndices))

# check fn3:
print(fn3)

# Plot:
emptyPlot(c(-10,1000), c(-1,1), h0=0, v0=indOutliers)
points(fn3, rep(.5, length(fn3)), pch='*')
points(fn20, rep(-.5, length(fn20)), pch='*')

plotfunctions documentation built on April 28, 2020, 5:10 p.m.