【发布时间】:2014-03-18 10:15:01
【问题描述】:
我正在尝试从包含 owin 对象(或任何与此相关的任何 spatstat 对象)的列表超帧中生成 spatstat hyperframes,但在 do.call 中使用 rbind.hyperframe 命令绑定列表时会遇到意外行为变成更大的hyperframe:
library(spatstat)
circles <- list(large = disc(10), medium = disc(5), small = disc(1))
circle.list <- lapply(names(circles), function(k) hyperframe(name = k, circle = circles[[k]]))
circle.list
# [[1]]
# Hyperframe:
# name circle
# 1 large (owin)
此时列表可以正常工作。 owin 对象分别位于列出的超帧的每个单元格中:
circle.list[[1]]$circle
#window: polygonal boundary
#enclosing rectangle: [-10, 10] x [-10, 10] units
接下来我使用do.call 命令来rbind 超帧:
circle.hyperframe <- do.call(rbind.hyperframe, circle.list)
circle.hyperframe
# Hyperframe:
# name circle
# 1 large (list)
# 2 medium (list)
# 3 small (list)
现在圆圈是列表(它们本质上是在 spatstat 中的),但它们似乎都绑定在一起:
names(circle.hyperframe[1,]$circle)
# [1] "type" "xrange" "yrange" "bdry" "units" "type" "xrange" "yrange" "bdry"
# [10] "units" "type" "xrange" "yrange" "bdry" "units"
注意一个单元格的三重名称。
我的代码依赖于列表,我非常希望能够将这些列表绑定到一个更大的hyperframe 中。 有没有办法解决这种行为,即如何在不绑定“圆形”列中的单元格的情况下重新绑定超帧?
【问题讨论】: