find_one_near: Internal function to help in matching observations.

Description Usage Arguments Value Examples

Description

Internal function to help in matching observations.

Usage

1
find_one_near(o, m, n_near = 5)

Arguments

o

is a value to match

m

is a named vector which is used to find a nearest match to the o

n_near

number of the nearest observations to derive a random match. If 'n_near' is greater than 'length(match_vector)', minimum out of two is used to create a sample for selecting a random match value.

Value

It produces a list of four elements:

Examples

1
2
3
4
5
library(syntheticpanel)
find_one_near(c("a" = 10), c(8:15), 3)
find_one_near(c("a" = 10), setNames(c(8:15), letters[1:8]), 5)
find_one_near(c(9), setNames(c(8:15), letters[1:8]), 5)
find_one_near(c(10), c(8:15), 5)

EBukin/syntheticpanel documentation built on May 9, 2019, 12:02 a.m.