View source: R/modules-sc-utils.R
get_nearest_row | R Documentation |
from Stack Overflow: 40668623
get_nearest_row(truth, test)
truth |
matrix to pick nearest from for all rows in |
test |
matrix to test each row of and find closest rows in |
vector of rows in truth
that are the nearest to each row in test
.
set.seed(123) ## for reproducibility
D <- 2 #amount of dimensions
K <- 5
events <- 2*K #number of events
truth <- matrix(data=runif(events, min = 0, max = 1), nrow=K)
E <- 2
test <- matrix(data=runif(2*E, min = 0, max = 1), nrow=E)
## Not run:
#[1] 4 3
get_nearest_row(truth, test)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.