如何在 R 的形状文件中绘制 txt 数据?

How to plot a txt data in a shape file in R?

我有一个 txt 数据,其中每一行都是一条带有纬度、经度和强度的闪电,我想在上面绘制一个 shapefile(多边形)。

我看不懂 shapefile,也不知道如何在 shapefile 上绘制数据,谁能帮帮我?也许有一些想法..

包裹sp是你的朋友。

library(sp)

data(meuse)

str(meuse)

coordinates(meuse) <- ~ x + y
plot(meuse)

您也可以试试包 sf。参见 vignettes