Bunu yapmanın daha iyi yolları vardır. Fakat eğer R becerileriniz minimum ise: ilk matris matrisini alt matrislere ayırabilirsiniz (her biri, toplamın büyüklüğünün 1/10'u, her bir alt matrisi ikinci matrise karşı çalıştırın ve daha sonra sonuçları birleştirin) . bitiş ben aynı sorunu vardı ve bu ben ile geldi budur
getwd()
setwd("C:/_R")
library(maptools)
require(rgdal)
# Read SHAPEFILE.shp from the current working directory (".")
points2010 <- readOGR(dsn = "C:/_R", layer = "points_2010")
metro <- readOGR(dsn = "C:/_R", layer = "selection")
plot(points2010)
plot(metro, axes=TRUE)
head(points2010)
library("rgeos")
ohio.metro <- spTransform(points2010, CRS("+proj=longlat +datum=WGS84"))
plot(ohio.metro, axes=TRUE)
ohio.metro$COUNTYFP10<-substr(ohio.metro$id,3,5)
countylist<-unique(ohio.metro$COUNTYFP10)
# "035" "055" "085" "093" "103"
ohio.county035 <- subset(ohio.metro, COUNTYFP10 == "035" )
ohio.county055 <- subset(ohio.metro, COUNTYFP10 == "055" )
ohio.county085 <- subset(ohio.metro, COUNTYFP10 == "085" )
ohio.county093 <- subset(ohio.metro, COUNTYFP10 == "093" )
ohio.county103 <- subset(ohio.metro, COUNTYFP10 == "103" )
plot(ohio.metro$COUNTYFP10) #counties in the metro
plot(ohio.county035$COUNTYFP10) # counties inthe county
plot(ohio.metro) #counties in the metro
plot(ohio.county035) # counties inthe county
#get the coordinats for the Great circle command
ohio.metro.coords <- [email protected]
ohio.county035.coords <- [email protected]
ohio.county055.coords <- [email protected]
ohio.county085.coords <- [email protected]
ohio.county093.coords <- [email protected]
ohio.county103.coords <- [email protected]
library(fields)
great_circle<-rdist.earth(ohio.county035.coords,ohio.metro.coords,miles=TRUE, R=NULL) #works
great_circle<-rdist.earth(ohio.county055.coords,ohio.metro.coords,miles=TRUE, R=NULL) #works
great_circle<-rdist.earth(ohio.county085.coords,ohio.metro.coords,miles=TRUE, R=NULL) #works
great_circle<-rdist.earth(ohio.county093.coords,ohio.metro.coords,miles=TRUE, R=NULL) #works
great_circle<-rdist.earth(ohio.county103.coords,ohio.metro.coords,miles=TRUE, R=NULL) #works
library(matrixStats)
bm<-rowMedians(great_circle)
head(bm)
bir yan not:. hiç alternatifleri için bu blogu okuma düşünün: http: //www.r-bloggers. com/büyük daire-mesafe-hesaplamalar-in-r/ – InfiniteFlashChess
lol evet Bunu hemen gönderdikten sonra buldum, şimdi tüm iyi – briahnah