我有一个要行绑定以创建单个sf对象的sf对象列表。我正在寻找一个类似于data.table::rbindlist的函数,它可以以一种有效的方式堆叠各个对象。
可重复使用的数据示例:
my_list <- structure(list(structure(list(idhex = 4L, geometry = structure(list(
structure(c(664106.970004623, 6524137.38910266), class = c("XY",
"POINT", "sfg"))), class = c("sfc_POINT", "sfc"), precision = 0, bbox = structure(c(xmin = 664106.970004623,
ymin = 6524137.38910266, xmax = 664106.970004623, ymax = 6524137.38910266
), class = "bbox"), crs = structure(list(epsg = 32633L, proj4string = "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"), class = "crs"), n_empty = 0L)), row.names = 1L, class = c("sf",
"data.frame"), sf_column = "geometry", agr = structure(c(idhex = NA_integer_), .Label = c("constant",
"aggregate", "identity"), class = "factor")), structure(list(
idhex = 9, geometry = structure(list(structure(c(665491.220375992,
6525002.7560692), class = c("XY", "POINT", "sfg"))), class = c("sfc_POINT",
"sfc"), precision = 0, bbox = structure(c(xmin = 665491.220375992,
ymin = 6525002.7560692, xmax = 665491.220375992, ymax = 6525002.7560692
), class = "bbox"), crs = structure(list(epsg = 32633L, proj4string = "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"), class = "crs"), n_empty = 0L)), row.names = 1L, class = c("sf",
"data.frame"), sf_column = "geometry", agr = structure(c(idhex = NA_integer_), .Label = c("constant",
"aggregate", "identity"), class = "factor"))), .Dim = 1:2, .Dimnames = list(
".", NULL))请注意,data.table和sf库尚未完全兼容。因此,rbindlist函数返回一个未被识别为` `sf对象的对象。
single_sf <- rbindlist(my_list)
class(single_sf)https://stackoverflow.com/questions/51312935
复制相似问题