需要使用R中的光栅包绘制我自己的形状文件以进行空间数据分析吗?

需要使用R中的光栅包绘制我自己的形状文件以进行空间数据分析吗?,r,R,我使用以下代码绘制数据: library(dismo) #download occurence data from gbif taxus_occurence <- gbif("taxus", "wallichiana*", geo=FALSE) View(taxus_occurence) head(taxus_occurence) dim(taxus_occurence) #select the records that have longitude and latitude data

我使用以下代码绘制数据:

library(dismo)
#download occurence data from gbif
taxus_occurence <- gbif("taxus", "wallichiana*", geo=FALSE)
View(taxus_occurence)

head(taxus_occurence)
dim(taxus_occurence)
#select the records that have longitude and latitude data
colnames(taxus_occurence)
tx_coordinates <- subset(taxus_occurence, !is.na(lon) & !is.na(lat))
dim(tx_coordinates)

# extract columns containing lat, long and country names
# select variables v1, v2, v3
myvars <- c("lat", "lon", "country")
newdata <- taxus_occurence[myvars]
newdata

#make a map of the occurrence localities
library(maptools)
## Checking rgeos availability: TRUE
data(wrld_simpl)
raster-taxus <- plot(wrld_simpl, xlim=c(-100,100), ylim=c(-100,100), 
axes=TRUE, col="light green")
# restore the box around the map
box()

# add the points
points(tx_coordinates$lon, tx_coordinates$lat, col='orange', pch=20, 
cex=0.75)
# plot points again to add a border, for better visibility
points(tx_coordinates$lon, tx_coordinates$lat, col='red', cex=0.75)
库(dismo)
#从gbif下载发生数据

红豆杉在网上有很多这方面的资源。检查
sf
package如果它是ESRI形状文件(
.shp
),请从
光栅
包中尝试
shapefile()