matchpt               package:Biobase               R Documentation

_F_i_n_d_s _N_e_a_r_e_s_t _N_e_i_g_h_b_o_u_r_s _f_o_r _S_e_t_s _o_f _P_o_i_n_t_s _g_i_v_e_n _b_y _N_x_D _C_o_o_r_d_i_n_a_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Finds nearest neighbours (using Euclidian distance) for sets of
     points given by coordinates. Can be used to match one dataset
     agains another or to locate nearest neighbours within a single
     dataset.

_U_s_a_g_e:

         matchpt(x, y = NULL)

_A_r_g_u_m_e_n_t_s:

       x: A matrix (or a vector) of coordinates. Rows represent
          different points in ND space, where N is the number of
          columns, and thus coordinates. If argument y is not given,
          match will be performed within x-dataset.

       y: If given a matrix (or a vector) of the same space (same N),
          that could however have different number of points. If given
          this argument is used to match x against it.

_V_a_l_u_e:

     A matrix of 2 columns and n rows, where n is the number of points
     in argument x. First column - index of the nearest neighbour,
     second column - distance to the nearest neighbour. If y is given,
     index corresponds to the index in y-dataset, if only x is given,
     then in x.

_A_u_t_h_o_r(_s):

     Oleg Sklyar, osklyar@ebi.ac.uk

_S_o_u_r_c_e:

     The C code for this routine is available in 'src/matchpt.c' of
     this package.

_R_e_f_e_r_e_n_c_e_s:

     Oleg Sklyar, EBI 2006

_E_x_a_m_p_l_e_s:

         a <- matrix(c(2,2,3,5,1,8,-1,4,5,6), ncol = 2, nrow = 5)
         matchpt(a)
         b <- c(1,2,4,5,6)
         d <- c(5.3, 3.2, 8.9, 1.3, 5.6, -6, 4.45, 3.32)
         matchpt(b, d)
         matchpt(d, b)

