Last data update: 2014.03.03

R: k-Nearest Neighbour Classification Cross-Validation
knn.cvR Documentation

k-Nearest Neighbour Classification Cross-Validation

Description

k-nearest neighbour classification cross-validation from training set.

Usage

knn.cv(train, cl, k = 1, prob = FALSE, algorithm=c("kd_tree", "cover_tree", "brute"))

Arguments

train

matrix or data frame of training set cases.

cl

factor of true classifications of training set

k

number of neighbours considered.

prob

if this is true, the proportion of the votes for the winning class are returned as attribute prob.

algorithm

nearest neighbor search algorithm.

Details

This uses leave-one-out cross validation. For each row of the training set train, the k nearest (in Euclidean distance) other training set vectors are found, and the classification is decided by majority vote, with ties broken at random. If there are ties for the kth nearest vector, all candidates are included in the vote.

Value

factor of classifications of training set. doubt will be returned as NA. distances and indice of k nearest neighbors are also returned as attributes.

Author(s)

Shengqiao Li. To report any bugs or suggestions please email: shli@stat.wvu.edu.

References

Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

knn and knn.cv in class.

Examples

  data(iris3)
  train <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
  cl <- factor(c(rep("s",50), rep("c",50), rep("v",50)))
  knn.cv(train, cl, k = 3, prob = TRUE)
  attributes(.Last.value)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(FNN)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FNN/knn.cv.Rd_%03d_medium.png", width=480, height=480)
> ### Name: knn.cv
> ### Title: k-Nearest Neighbour Classification Cross-Validation
> ### Aliases: knn.cv
> ### Keywords: classif nonparametric
> 
> ### ** Examples
> 
>   data(iris3)
>   train <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
>   cl <- factor(c(rep("s",50), rep("c",50), rep("v",50)))
>   knn.cv(train, cl, k = 3, prob = TRUE)
  [1] s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s
 [38] s s s s s s s s s s s s s c c c c c c c c c c c c c c c c c c c c v c v c
 [75] c c c c c c c c c v c c c c c c c c c c c c c c c c v v v v v v c v v v v
[112] v v v v v v v v c v v v v v v v v v v v v v c v v v v v v v v v v v v v v
[149] v v
attr(,"prob")
  [1] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
  [8] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [22] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [29] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [36] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [43] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [50] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [57] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [64] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 1.0000000
 [71] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [78] 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [85] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [92] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [99] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[106] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 1.0000000
[113] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[120] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[127] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[134] 0.6666667 0.6666667 1.0000000 1.0000000 1.0000000 0.6666667 1.0000000
[141] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[148] 1.0000000 1.0000000 1.0000000
attr(,"nn.index")
       [,1] [,2] [,3]
  [1,]   18    5   40
  [2,]   35   46   13
  [3,]   48    4    7
  [4,]   48   30   31
  [5,]   38    1   18
  [6,]   19   11   49
  [7,]   48    3   12
  [8,]   40   50    1
  [9,]   39    4   43
 [10,]   35    2   31
 [11,]   49   28   37
 [12,]   30    8   27
 [13,]    2   10   46
 [14,]   39   43    9
 [15,]   34   17   16
 [16,]   34   15    6
 [17,]   11   49   34
 [18,]    1   41    5
 [19,]    6   11   49
 [20,]   22   47   49
 [21,]   32   28   29
 [22,]   20   47   18
 [23,]    7    3   38
 [24,]   27   44   40
 [25,]   12   30   27
 [26,]   35   10    2
 [27,]   24   44    8
 [28,]   29    1   40
 [29,]   28   40    1
 [30,]   31    4   12
 [31,]   30   35   10
 [32,]   21   28   29
 [33,]   34   47   20
 [34,]   33   16   17
 [35,]   10    2   31
 [36,]   50    2    3
 [37,]   11   32   29
 [38,]    5    1   41
 [39,]    9   43   14
 [40,]    8    1   28
 [41,]   18    1    5
 [42,]    9   39   46
 [43,]   39   48    4
 [44,]   27   24   22
 [45,]   47    6   22
 [46,]    2   13   35
 [47,]   20   22   49
 [48,]    4    3   43
 [49,]   11   28   20
 [50,]    8   40   36
 [51,]   53   87   66
 [52,]   57   76   66
 [53,]   51   87   78
 [54,]   90   81   70
 [55,]   59   76   77
 [56,]   67   91   97
 [57,]   52   86   92
 [58,]   94   99   61
 [59,]   76   55   66
 [60,]   90   95   54
 [61,]   94   58   82
 [62,]   97   79   96
 [63,]   93   70   68
 [64,]   92   74   79
 [65,]   83   80   89
 [66,]   76   59   87
 [67,]   85   56   97
 [68,]   93   83  100
 [69,]   88   73  120
 [70,]   81   90   82
 [71,]  139  128  150
 [72,]   98   83   93
 [73,]  134  124  147
 [74,]   64   92   79
 [75,]   98   76   59
 [76,]   66   59   75
 [77,]   59   87   53
 [78,]   53   87  148
 [79,]   92   64   62
 [80,]   82   81   70
 [81,]   82   70   90
 [82,]   81   70   80
 [83,]   93  100   68
 [84,]  134  102  143
 [85,]   67   56   97
 [86,]   57   71   52
 [87,]   53   66   59
 [88,]   69   73   63
 [89,]   96   97  100
 [90,]   54   70   81
 [91,]   95   56   97
 [92,]   64   79   74
 [93,]   83   68  100
 [94,]   58   61   99
 [95,]  100   97   91
 [96,]   97   89  100
 [97,]   96  100   89
 [98,]   75   72   92
 [99,]   58   94   61
[100,]   97   95   89
[101,]  137  145  105
[102,]  143  114  122
[103,]  126  121  144
[104,]  117  138  129
[105,]  133  129  141
[106,]  123  108  136
[107,]   85   60   91
[108,]  131  126  106
[109,]  129  104  117
[110,]  144  121  145
[111,]  148  116   78
[112,]  148  129  147
[113,]  140  141  121
[114,]  143  102  122
[115,]  122  102  143
[116,]  149  111  146
[117,]  138  104  148
[118,]  132  106  110
[119,]  123  106  136
[120,]   73   84   69
[121,]  144  141  125
[122,]  143  102  114
[123,]  106  119  108
[124,]  127  147  128
[125,]  121  144  141
[126,]  130  103  108
[127,]  124  128  139
[128,]  139  127  150
[129,]  133  105  104
[130,]  126  131  103
[131,]  108  103  126
[132,]  118  106  136
[133,]  129  105  104
[134,]   84   73  124
[135,]  104   84  134
[136,]  131  106  103
[137,]  149  116  101
[138,]  117  104  148
[139,]  128   71  127
[140,]  113  146  142
[141,]  145  121  113
[142,]  146  140  113
[143,]  143  114  122
[144,]  121  125  145
[145,]  141  121  144
[146,]  142  148  140
[147,]  124  112  127
[148,]  111  112  117
[149,]  137  116  111
[150,]  128  139  102
attr(,"nn.dist")
            [,1]      [,2]      [,3]
  [1,] 0.1000000 0.1414214 0.1414214
  [2,] 0.1414214 0.1414214 0.1414214
  [3,] 0.1414214 0.2449490 0.2645751
  [4,] 0.1414214 0.1732051 0.2236068
  [5,] 0.1414214 0.1414214 0.1732051
  [6,] 0.3316625 0.3464102 0.3605551
  [7,] 0.2236068 0.2645751 0.3000000
  [8,] 0.1000000 0.1414214 0.1732051
  [9,] 0.1414214 0.3000000 0.3162278
 [10,] 0.1000000 0.1732051 0.1732051
 [11,] 0.1000000 0.2828427 0.3000000
 [12,] 0.2236068 0.2236068 0.2828427
 [13,] 0.1414214 0.1732051 0.2000000
 [14,] 0.2449490 0.3162278 0.3464102
 [15,] 0.4123106 0.4690416 0.5477226
 [16,] 0.3605551 0.5477226 0.6164414
 [17,] 0.3464102 0.3605551 0.3872983
 [18,] 0.1000000 0.1414214 0.1732051
 [19,] 0.3316625 0.3872983 0.4690416
 [20,] 0.1414214 0.1414214 0.2449490
 [21,] 0.2828427 0.3000000 0.3605551
 [22,] 0.1414214 0.2449490 0.2449490
 [23,] 0.4582576 0.5099020 0.5099020
 [24,] 0.2000000 0.2645751 0.3741657
 [25,] 0.3000000 0.3741657 0.4123106
 [26,] 0.1732051 0.2000000 0.2236068
 [27,] 0.2000000 0.2236068 0.2236068
 [28,] 0.1414214 0.1414214 0.1414214
 [29,] 0.1414214 0.1414214 0.1414214
 [30,] 0.1414214 0.1732051 0.2236068
 [31,] 0.1414214 0.1414214 0.1732051
 [32,] 0.2828427 0.3000000 0.3000000
 [33,] 0.3464102 0.3464102 0.3741657
 [34,] 0.3464102 0.3605551 0.3872983
 [35,] 0.1000000 0.1414214 0.1414214
 [36,] 0.2236068 0.3000000 0.3162278
 [37,] 0.3000000 0.3162278 0.3316625
 [38,] 0.1414214 0.2449490 0.2645751
 [39,] 0.1414214 0.2000000 0.2449490
 [40,] 0.1000000 0.1414214 0.1414214
 [41,] 0.1414214 0.1732051 0.1732051
 [42,] 0.6244998 0.7141428 0.7681146
 [43,] 0.2000000 0.2236068 0.3000000
 [44,] 0.2236068 0.2645751 0.3162278
 [45,] 0.3605551 0.3741657 0.4123106
 [46,] 0.1414214 0.2000000 0.2000000
 [47,] 0.1414214 0.2449490 0.2449490
 [48,] 0.1414214 0.1414214 0.2236068
 [49,] 0.1000000 0.2236068 0.2449490
 [50,] 0.1414214 0.1732051 0.2236068
 [51,] 0.2645751 0.3316625 0.4358899
 [52,] 0.2645751 0.3162278 0.3464102
 [53,] 0.2645751 0.2828427 0.3162278
 [54,] 0.2000000 0.3000000 0.3162278
 [55,] 0.2449490 0.3162278 0.3741657
 [56,] 0.3000000 0.3162278 0.3162278
 [57,] 0.2645751 0.3741657 0.4242641
 [58,] 0.1414214 0.3872983 0.4582576
 [59,] 0.2449490 0.2449490 0.3162278
 [60,] 0.3872983 0.5099020 0.5196152
 [61,] 0.3605551 0.4582576 0.6708204
 [62,] 0.3000000 0.3316625 0.3605551
 [63,] 0.4898979 0.5196152 0.5477226
 [64,] 0.1414214 0.2236068 0.2449490
 [65,] 0.4242641 0.4472136 0.5099020
 [66,] 0.1414214 0.3162278 0.3162278
 [67,] 0.2000000 0.3000000 0.3872983
 [68,] 0.2449490 0.2828427 0.3316625
 [69,] 0.2645751 0.5099020 0.5385165
 [70,] 0.1732051 0.2449490 0.2645751
 [71,] 0.2236068 0.3000000 0.3605551
 [72,] 0.3316625 0.3464102 0.3741657
 [73,] 0.3605551 0.3605551 0.4123106
 [74,] 0.2236068 0.3000000 0.3872983
 [75,] 0.2000000 0.2645751 0.3605551
 [76,] 0.1414214 0.2449490 0.2645751
 [77,] 0.3162278 0.3464102 0.3464102
 [78,] 0.3162278 0.3741657 0.4123106
 [79,] 0.2000000 0.2449490 0.3316625
 [80,] 0.3464102 0.4242641 0.4358899
 [81,] 0.1414214 0.1732051 0.3000000
 [82,] 0.1414214 0.2645751 0.3464102
 [83,] 0.1414214 0.2645751 0.2828427
 [84,] 0.3316625 0.3605551 0.3605551
 [85,] 0.2000000 0.4123106 0.4795832
 [86,] 0.3741657 0.4242641 0.4582576
 [87,] 0.2828427 0.3162278 0.3162278
 [88,] 0.2645751 0.5744563 0.5916080
 [89,] 0.1732051 0.1732051 0.2236068
 [90,] 0.2000000 0.2449490 0.3000000
 [91,] 0.2645751 0.3162278 0.4242641
 [92,] 0.1414214 0.2000000 0.3000000
 [93,] 0.1414214 0.2449490 0.2645751
 [94,] 0.1414214 0.3605551 0.3872983
 [95,] 0.1732051 0.2236068 0.2645751
 [96,] 0.1414214 0.1732051 0.2449490
 [97,] 0.1414214 0.1414214 0.1732051
 [98,] 0.2000000 0.3316625 0.3464102
 [99,] 0.3872983 0.3872983 0.7211103
[100,] 0.1414214 0.1732051 0.2236068
[101,] 0.4242641 0.5000000 0.5099020
[102,] 0.0000000 0.2645751 0.3162278
[103,] 0.3872983 0.4000000 0.4123106
[104,] 0.2449490 0.2449490 0.3316625
[105,] 0.3000000 0.3162278 0.3605551
[106,] 0.2645751 0.5291503 0.5477226
[107,] 0.7348469 0.7615773 0.7937254
[108,] 0.2645751 0.4358899 0.5291503
[109,] 0.5567764 0.6000000 0.6164414
[110,] 0.6324555 0.6708204 0.7071068
[111,] 0.2236068 0.3741657 0.4242641
[112,] 0.3464102 0.3741657 0.3741657
[113,] 0.1732051 0.3464102 0.3605551
[114,] 0.2645751 0.2645751 0.3316625
[115,] 0.4898979 0.5099020 0.5099020
[116,] 0.3000000 0.3741657 0.3741657
[117,] 0.1414214 0.2449490 0.3605551
[118,] 0.4123106 0.8185353 0.8602325
[119,] 0.4123106 0.5477226 0.8944272
[120,] 0.4358899 0.5196152 0.5385165
[121,] 0.2236068 0.2645751 0.3000000
[122,] 0.3162278 0.3162278 0.3316625
[123,] 0.2645751 0.4123106 0.6082763
[124,] 0.1732051 0.2449490 0.3605551
[125,] 0.3000000 0.3162278 0.3741657
[126,] 0.3464102 0.3872983 0.4358899
[127,] 0.1732051 0.2449490 0.2828427
[128,] 0.1414214 0.2449490 0.2828427
[129,] 0.1000000 0.3162278 0.3316625
[130,] 0.3464102 0.5099020 0.5196152
[131,] 0.2645751 0.4582576 0.4690416
[132,] 0.4123106 0.8831761 0.9273618
[133,] 0.1000000 0.3000000 0.4242641
[134,] 0.3316625 0.3605551 0.3741657
[135,] 0.5385165 0.5567764 0.5830952
[136,] 0.5385165 0.5477226 0.6633250
[137,] 0.2449490 0.3872983 0.4242641
[138,] 0.1414214 0.2449490 0.3872983
[139,] 0.1414214 0.2236068 0.2828427
[140,] 0.1732051 0.3605551 0.3605551
[141,] 0.2449490 0.2645751 0.3464102
[142,] 0.2449490 0.3605551 0.4690416
[143,] 0.0000000 0.2645751 0.3162278
[144,] 0.2236068 0.3162278 0.3162278
[145,] 0.2449490 0.3000000 0.3162278
[146,] 0.2449490 0.3605551 0.3605551
[147,] 0.2449490 0.3741657 0.3872983
[148,] 0.2236068 0.3464102 0.3605551
[149,] 0.2449490 0.3000000 0.5567764
[150,] 0.2828427 0.3162278 0.3316625
Levels: c s v
>   attributes(.Last.value)
$levels
[1] "c" "s" "v"

$class
[1] "factor"

$prob
  [1] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
  [8] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [22] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [29] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [36] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [43] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [50] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [57] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [64] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 1.0000000
 [71] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [78] 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [85] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [92] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
 [99] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[106] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 1.0000000
[113] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[120] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[127] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[134] 0.6666667 0.6666667 1.0000000 1.0000000 1.0000000 0.6666667 1.0000000
[141] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[148] 1.0000000 1.0000000 1.0000000

$nn.index
       [,1] [,2] [,3]
  [1,]   18    5   40
  [2,]   35   46   13
  [3,]   48    4    7
  [4,]   48   30   31
  [5,]   38    1   18
  [6,]   19   11   49
  [7,]   48    3   12
  [8,]   40   50    1
  [9,]   39    4   43
 [10,]   35    2   31
 [11,]   49   28   37
 [12,]   30    8   27
 [13,]    2   10   46
 [14,]   39   43    9
 [15,]   34   17   16
 [16,]   34   15    6
 [17,]   11   49   34
 [18,]    1   41    5
 [19,]    6   11   49
 [20,]   22   47   49
 [21,]   32   28   29
 [22,]   20   47   18
 [23,]    7    3   38
 [24,]   27   44   40
 [25,]   12   30   27
 [26,]   35   10    2
 [27,]   24   44    8
 [28,]   29    1   40
 [29,]   28   40    1
 [30,]   31    4   12
 [31,]   30   35   10
 [32,]   21   28   29
 [33,]   34   47   20
 [34,]   33   16   17
 [35,]   10    2   31
 [36,]   50    2    3
 [37,]   11   32   29
 [38,]    5    1   41
 [39,]    9   43   14
 [40,]    8    1   28
 [41,]   18    1    5
 [42,]    9   39   46
 [43,]   39   48    4
 [44,]   27   24   22
 [45,]   47    6   22
 [46,]    2   13   35
 [47,]   20   22   49
 [48,]    4    3   43
 [49,]   11   28   20
 [50,]    8   40   36
 [51,]   53   87   66
 [52,]   57   76   66
 [53,]   51   87   78
 [54,]   90   81   70
 [55,]   59   76   77
 [56,]   67   91   97
 [57,]   52   86   92
 [58,]   94   99   61
 [59,]   76   55   66
 [60,]   90   95   54
 [61,]   94   58   82
 [62,]   97   79   96
 [63,]   93   70   68
 [64,]   92   74   79
 [65,]   83   80   89
 [66,]   76   59   87
 [67,]   85   56   97
 [68,]   93   83  100
 [69,]   88   73  120
 [70,]   81   90   82
 [71,]  139  128  150
 [72,]   98   83   93
 [73,]  134  124  147
 [74,]   64   92   79
 [75,]   98   76   59
 [76,]   66   59   75
 [77,]   59   87   53
 [78,]   53   87  148
 [79,]   92   64   62
 [80,]   82   81   70
 [81,]   82   70   90
 [82,]   81   70   80
 [83,]   93  100   68
 [84,]  134  102  143
 [85,]   67   56   97
 [86,]   57   71   52
 [87,]   53   66   59
 [88,]   69   73   63
 [89,]   96   97  100
 [90,]   54   70   81
 [91,]   95   56   97
 [92,]   64   79   74
 [93,]   83   68  100
 [94,]   58   61   99
 [95,]  100   97   91
 [96,]   97   89  100
 [97,]   96  100   89
 [98,]   75   72   92
 [99,]   58   94   61
[100,]   97   95   89
[101,]  137  145  105
[102,]  143  114  122
[103,]  126  121  144
[104,]  117  138  129
[105,]  133  129  141
[106,]  123  108  136
[107,]   85   60   91
[108,]  131  126  106
[109,]  129  104  117
[110,]  144  121  145
[111,]  148  116   78
[112,]  148  129  147
[113,]  140  141  121
[114,]  143  102  122
[115,]  122  102  143
[116,]  149  111  146
[117,]  138  104  148
[118,]  132  106  110
[119,]  123  106  136
[120,]   73   84   69
[121,]  144  141  125
[122,]  143  102  114
[123,]  106  119  108
[124,]  127  147  128
[125,]  121  144  141
[126,]  130  103  108
[127,]  124  128  139
[128,]  139  127  150
[129,]  133  105  104
[130,]  126  131  103
[131,]  108  103  126
[132,]  118  106  136
[133,]  129  105  104
[134,]   84   73  124
[135,]  104   84  134
[136,]  131  106  103
[137,]  149  116  101
[138,]  117  104  148
[139,]  128   71  127
[140,]  113  146  142
[141,]  145  121  113
[142,]  146  140  113
[143,]  143  114  122
[144,]  121  125  145
[145,]  141  121  144
[146,]  142  148  140
[147,]  124  112  127
[148,]  111  112  117
[149,]  137  116  111
[150,]  128  139  102

$nn.dist
            [,1]      [,2]      [,3]
  [1,] 0.1000000 0.1414214 0.1414214
  [2,] 0.1414214 0.1414214 0.1414214
  [3,] 0.1414214 0.2449490 0.2645751
  [4,] 0.1414214 0.1732051 0.2236068
  [5,] 0.1414214 0.1414214 0.1732051
  [6,] 0.3316625 0.3464102 0.3605551
  [7,] 0.2236068 0.2645751 0.3000000
  [8,] 0.1000000 0.1414214 0.1732051
  [9,] 0.1414214 0.3000000 0.3162278
 [10,] 0.1000000 0.1732051 0.1732051
 [11,] 0.1000000 0.2828427 0.3000000
 [12,] 0.2236068 0.2236068 0.2828427
 [13,] 0.1414214 0.1732051 0.2000000
 [14,] 0.2449490 0.3162278 0.3464102
 [15,] 0.4123106 0.4690416 0.5477226
 [16,] 0.3605551 0.5477226 0.6164414
 [17,] 0.3464102 0.3605551 0.3872983
 [18,] 0.1000000 0.1414214 0.1732051
 [19,] 0.3316625 0.3872983 0.4690416
 [20,] 0.1414214 0.1414214 0.2449490
 [21,] 0.2828427 0.3000000 0.3605551
 [22,] 0.1414214 0.2449490 0.2449490
 [23,] 0.4582576 0.5099020 0.5099020
 [24,] 0.2000000 0.2645751 0.3741657
 [25,] 0.3000000 0.3741657 0.4123106
 [26,] 0.1732051 0.2000000 0.2236068
 [27,] 0.2000000 0.2236068 0.2236068
 [28,] 0.1414214 0.1414214 0.1414214
 [29,] 0.1414214 0.1414214 0.1414214
 [30,] 0.1414214 0.1732051 0.2236068
 [31,] 0.1414214 0.1414214 0.1732051
 [32,] 0.2828427 0.3000000 0.3000000
 [33,] 0.3464102 0.3464102 0.3741657
 [34,] 0.3464102 0.3605551 0.3872983
 [35,] 0.1000000 0.1414214 0.1414214
 [36,] 0.2236068 0.3000000 0.3162278
 [37,] 0.3000000 0.3162278 0.3316625
 [38,] 0.1414214 0.2449490 0.2645751
 [39,] 0.1414214 0.2000000 0.2449490
 [40,] 0.1000000 0.1414214 0.1414214
 [41,] 0.1414214 0.1732051 0.1732051
 [42,] 0.6244998 0.7141428 0.7681146
 [43,] 0.2000000 0.2236068 0.3000000
 [44,] 0.2236068 0.2645751 0.3162278
 [45,] 0.3605551 0.3741657 0.4123106
 [46,] 0.1414214 0.2000000 0.2000000
 [47,] 0.1414214 0.2449490 0.2449490
 [48,] 0.1414214 0.1414214 0.2236068
 [49,] 0.1000000 0.2236068 0.2449490
 [50,] 0.1414214 0.1732051 0.2236068
 [51,] 0.2645751 0.3316625 0.4358899
 [52,] 0.2645751 0.3162278 0.3464102
 [53,] 0.2645751 0.2828427 0.3162278
 [54,] 0.2000000 0.3000000 0.3162278
 [55,] 0.2449490 0.3162278 0.3741657
 [56,] 0.3000000 0.3162278 0.3162278
 [57,] 0.2645751 0.3741657 0.4242641
 [58,] 0.1414214 0.3872983 0.4582576
 [59,] 0.2449490 0.2449490 0.3162278
 [60,] 0.3872983 0.5099020 0.5196152
 [61,] 0.3605551 0.4582576 0.6708204
 [62,] 0.3000000 0.3316625 0.3605551
 [63,] 0.4898979 0.5196152 0.5477226
 [64,] 0.1414214 0.2236068 0.2449490
 [65,] 0.4242641 0.4472136 0.5099020
 [66,] 0.1414214 0.3162278 0.3162278
 [67,] 0.2000000 0.3000000 0.3872983
 [68,] 0.2449490 0.2828427 0.3316625
 [69,] 0.2645751 0.5099020 0.5385165
 [70,] 0.1732051 0.2449490 0.2645751
 [71,] 0.2236068 0.3000000 0.3605551
 [72,] 0.3316625 0.3464102 0.3741657
 [73,] 0.3605551 0.3605551 0.4123106
 [74,] 0.2236068 0.3000000 0.3872983
 [75,] 0.2000000 0.2645751 0.3605551
 [76,] 0.1414214 0.2449490 0.2645751
 [77,] 0.3162278 0.3464102 0.3464102
 [78,] 0.3162278 0.3741657 0.4123106
 [79,] 0.2000000 0.2449490 0.3316625
 [80,] 0.3464102 0.4242641 0.4358899
 [81,] 0.1414214 0.1732051 0.3000000
 [82,] 0.1414214 0.2645751 0.3464102
 [83,] 0.1414214 0.2645751 0.2828427
 [84,] 0.3316625 0.3605551 0.3605551
 [85,] 0.2000000 0.4123106 0.4795832
 [86,] 0.3741657 0.4242641 0.4582576
 [87,] 0.2828427 0.3162278 0.3162278
 [88,] 0.2645751 0.5744563 0.5916080
 [89,] 0.1732051 0.1732051 0.2236068
 [90,] 0.2000000 0.2449490 0.3000000
 [91,] 0.2645751 0.3162278 0.4242641
 [92,] 0.1414214 0.2000000 0.3000000
 [93,] 0.1414214 0.2449490 0.2645751
 [94,] 0.1414214 0.3605551 0.3872983
 [95,] 0.1732051 0.2236068 0.2645751
 [96,] 0.1414214 0.1732051 0.2449490
 [97,] 0.1414214 0.1414214 0.1732051
 [98,] 0.2000000 0.3316625 0.3464102
 [99,] 0.3872983 0.3872983 0.7211103
[100,] 0.1414214 0.1732051 0.2236068
[101,] 0.4242641 0.5000000 0.5099020
[102,] 0.0000000 0.2645751 0.3162278
[103,] 0.3872983 0.4000000 0.4123106
[104,] 0.2449490 0.2449490 0.3316625
[105,] 0.3000000 0.3162278 0.3605551
[106,] 0.2645751 0.5291503 0.5477226
[107,] 0.7348469 0.7615773 0.7937254
[108,] 0.2645751 0.4358899 0.5291503
[109,] 0.5567764 0.6000000 0.6164414
[110,] 0.6324555 0.6708204 0.7071068
[111,] 0.2236068 0.3741657 0.4242641
[112,] 0.3464102 0.3741657 0.3741657
[113,] 0.1732051 0.3464102 0.3605551
[114,] 0.2645751 0.2645751 0.3316625
[115,] 0.4898979 0.5099020 0.5099020
[116,] 0.3000000 0.3741657 0.3741657
[117,] 0.1414214 0.2449490 0.3605551
[118,] 0.4123106 0.8185353 0.8602325
[119,] 0.4123106 0.5477226 0.8944272
[120,] 0.4358899 0.5196152 0.5385165
[121,] 0.2236068 0.2645751 0.3000000
[122,] 0.3162278 0.3162278 0.3316625
[123,] 0.2645751 0.4123106 0.6082763
[124,] 0.1732051 0.2449490 0.3605551
[125,] 0.3000000 0.3162278 0.3741657
[126,] 0.3464102 0.3872983 0.4358899
[127,] 0.1732051 0.2449490 0.2828427
[128,] 0.1414214 0.2449490 0.2828427
[129,] 0.1000000 0.3162278 0.3316625
[130,] 0.3464102 0.5099020 0.5196152
[131,] 0.2645751 0.4582576 0.4690416
[132,] 0.4123106 0.8831761 0.9273618
[133,] 0.1000000 0.3000000 0.4242641
[134,] 0.3316625 0.3605551 0.3741657
[135,] 0.5385165 0.5567764 0.5830952
[136,] 0.5385165 0.5477226 0.6633250
[137,] 0.2449490 0.3872983 0.4242641
[138,] 0.1414214 0.2449490 0.3872983
[139,] 0.1414214 0.2236068 0.2828427
[140,] 0.1732051 0.3605551 0.3605551
[141,] 0.2449490 0.2645751 0.3464102
[142,] 0.2449490 0.3605551 0.4690416
[143,] 0.0000000 0.2645751 0.3162278
[144,] 0.2236068 0.3162278 0.3162278
[145,] 0.2449490 0.3000000 0.3162278
[146,] 0.2449490 0.3605551 0.3605551
[147,] 0.2449490 0.3741657 0.3872983
[148,] 0.2236068 0.3464102 0.3605551
[149,] 0.2449490 0.3000000 0.5567764
[150,] 0.2828427 0.3162278 0.3316625

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>