Nearest Neighbour in R
来源:互联网 发布:何曼婷淘宝店 编辑:程序博客网 时间:2024/05/29 18:22
Package in use: "spatstat"
Data:
> title <- c("Name", "X", "Y", "Surface", "Date", "Temprature")> GWT <- read.csv2("E:\\Slides\\Geostatistics & Geomarketing(Nein)\\data\\Groundwater_Temperature.csv", header = TRUE, sep = ",", dec = ".", col.names = title)> GWT_sub <- subset(GWT, subset = (GWT$Surface >0))> head(GWT_sub) Name X Y Surface Date Temprature1 ABP9922 4459725 5340978 497.50 7/25/09 9.92 ABP9926 4460005 5341246 498.90 7/25/09 12.03 BP 25 4464282 5331784 534.17 7/26/09 9.94 BP 26 4464222 5330721 542.08 7/27/09 10.55 BP 32 4460921 5337893 509.09 7/25/09 11.66 BP 49 4463843 5339414 501.50 7/24/09 11.3
> Xgwt_subset <- ppp(GWT_sub$X, GWT_sub$Y, window = owin(c(min(GWT_sub$X), max(GWT_sub$X)), c(min(GWT_sub$Y), max(GWT_sub$Y))), marks = GWT_sub$Temperature)> plot(Xgwt_subset)> plot(Xgwt_subset, main = "GWT")
Calculating neighbors of each points. M means that, the 85th point is neighbor of the 1st point, 170th point is the nearest neighbor of 2ed point. b is another dataset for every points' neighbors.
> m <- nnwhich(GWT_sub$X, GWT_sub$Y)> m [1] 2 1 407 411 257 143 319 14 13 80 12 11 9 8 44 53 107 104 329 6 [21] 102 268 198 194 284 233 233 170 142 19 299 278 47 159 25 291 131 39 40 39... ...> b <- GWT_sub[m, ]
Displaying.
> arrows(GWT_sub$X, GWT_sub$Y, b$X, b$Y, col = "red", length = 0.06)
0 0
- Nearest Neighbour in R
- Indexed Nearest Neighbour Search in PostGIS
- SOJ2099 Search Nearest Neighbour
- K Nearest-Neighbour 总结
- Understanding k-Nearest Neighbour
- Instance-based Learning: K-Nearest Neighbour Algorithm && Radial Basis Function
- OpenCV(2)ML库->K-Nearest Neighbour分类器
- A Bayesian reassessment of nearest neighbour classication阅读解读
- C++实现的简单k近邻算法(K-Nearest-Neighbour,K-NN)
- <ML In Action系列>k-Nearest Neighbors
- Machine Learning in action:k-Nearest Neighbor
- [R] Expression in R graphics
- In Defense of Nearest-Neighbor Based Image Classification
- Machine Learning In Action -- kNN (k Nearest Neighbors)
- machine learning in R
- Factors in R
- Mahalanobis distance in R
- Functions in R
- 【HDU5213 BestCoder Round 39D】【莫队算法+容斥】Lucky 两个区间各选一个数使得和为K的方案数
- 教你怎么开发VR游戏系列教程三:VR游戏开发中常见的一些概念
- UCOSII学习归纳一
- 分布式文件系统 FastDFS
- yii2自定义日志
- Nearest Neighbour in R
- 几款主流的压缩算法对比Zlib,snappy,lz4
- mysql null 转0
- 第2章 循环结构程序设计
- 简单项目开发之一(springmvc+filter)
- Android 的log的具体分析 二
- 求最大面积
- 2015年大二上-数据结构-队列(3)- 负数把正数赶出队列
- yii2 Class 'frontend\controllers\Logger' not found