I would like to create a squared matrix with 3003 rows an 3003 columns (number of rows in MyData) It worked that the matrix is created and filled with 3003 rows but only 100 columns and I do not get why.
library(sp)
Dists <- matrix(0, nrow=nrow(MyData), ncol = nrow(MyData))
for(n in 1:nrow(MyData)){
Dists[n,] <- spDistsN1(pt = c(MyData$lng[n], MyData$lat[n]),
pts = as.matrix(MyData[,c("lng","lat")]))
Thanks for your help.