우리에게 많은 것을주지는 않지만 이것을 시도하고 싶을 수도 있습니다 (아래 예 :) 좌표 데이터가 WGS84 데이터를 사용하여 위도 - 길이 형식으로되어 있다고 가정합니다. 2 차원 공간에서 점의 표현이 잘못 될 수 있으므로 투영 정보를 찾으십시오.
require(sp)
require(raster)
require(maptools)
#Some dummy data in the format you have described
base <- data.frame(longitude = sample(c(-20:20) , 10) , latitude = sample(c(-30:30) , 10) , species = sample(letters[1:3] , 10 , repl = TRUE))
head(base)
# longitude latitude species
# 1 -10 7 a
# 2 3 14 b
# 3 -9 29 b
# 4 -8 -25 a
# 5 0 -19 b
# 6 -19 19 c
#Make spatial points dataframe, which will have a spatial extent
spdf <- SpatialPointsDataFrame(base[ c("longitude" , "latitude") ] , data = data.frame(base$species) , proj4string = CRS("+proj=longlat +datum=WGS84"))
#make raster based on the extent of your data
r <- raster(extent(spdf))
r
# class : RasterLayer
# dimensions : 10, 10, 100 (nrow, ncol, ncell)
# resolution : 3.3, 5.8 (x, y)
# extent : -20, 13, -29, 29 (xmin, xmax, ymin, ymax)
# coord. ref. : NA
# values : none
'기준'이 데이터 프레임 일 가능성이 있습니다. 'as.matrix)'문제를 해결할 수 있습니다. – Azim