# NOT RUN {
set.seed(654321)
x <- rnorm(100, 1, 0.5)
F <- ecdf(x)
fval <- F(x)
map <- match_func(knots = x, vals = fval)
x2 <- rnorm(20, 0.8, 0.5)
F2 <- ecdf(x2)
fval2 <- F2(x2)
matched <- match_func(knots = x, vals = fval, new_vals = fval2)
## Plot histograms...
opar <- par(mfrow = c(1, 3))
hist(x); hist(x2); hist(matched)
par(opar) # Reset par
# }
Run the code above in your browser using DataLab