将两个或多个Estudm对象组合到一个单个Estudm对象中

发布于 2025-02-12 18:00:54 字数 746 浏览 0 评论 0原文

我知道可以使用:使用:将两个或多个 estudm 对象组合到一个单个estudm对象中

tot <- list(estUD1=estUD1, estUD2=estUD2, estUD3=estUD3)
class(tot) <- "estUDm"

,可以将多个estud对象组合到单个类中的对象中吗?我尝试使用相同的原理; IE

tot <- list(estUDm1=estUDm1, estUDm2=estUDm2, estUDm3=estUDm3)
class(tot) <- "estUDm"

但是,这会导致以下错误:

> tot
********** Utilization distribution of several Animals ************

Error in print.estUDm(x) : 
  trying to get slot "vol" from an object (class "estUDm") that is not an S4 object 

就我而言,我的目标是使用相同的网格运行两个KDE分析,但是不同的smoother(因此我最终使用了两个estudm对象),然后结合这些分析使用kerneloverlaphr()的多边形。

我没有成功地尝试找到 /创建可以一次计算多个多边形重叠的替代代码,因此我对kerneloverlaphr()的依赖。

I know it is possible to combine multiple estUD objects into a single class-estUDm object using:

tot <- list(estUD1=estUD1, estUD2=estUD2, estUD3=estUD3)
class(tot) <- "estUDm"

However, is it possible to combine two or more estUDm objects into a single estUDm object? I have tried using the same principle; i.e.

tot <- list(estUDm1=estUDm1, estUDm2=estUDm2, estUDm3=estUDm3)
class(tot) <- "estUDm"

however, this results in the following error :

> tot
********** Utilization distribution of several Animals ************

Error in print.estUDm(x) : 
  trying to get slot "vol" from an object (class "estUDm") that is not an S4 object 

In my case, my objective is to run two KDE analyses with the same grid, but different smoothers (hence I end up with two estUDm objects), and then combine these to calculate the % overlap of polygons using kerneloverlaphr().

I have unsuccessfully tried to find / create alternative code that can calculate the overlap of multiple polygons in one go, hence my reliance on kerneloverlaphr().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱纠缠 2025-02-19 18:00:54

这有点晚了,但是由于班级示例只是类观察的列表,所以我相信您可以毫不及格地获得类观察,将这些列入新列表中,然后指定estudm类。下面的一个示例。

library(adehabitatHR)
library(sp)

#example data
data(puechabonsp)
dat <- puechabonsp$relocs
dat$Name <- as.character(dat$Name)

#split into two datasets
d1 <- dat[dat$Name == 'Brock' | dat$Name == 'Jean', ]
d2 <- dat[dat$Name != 'Brock' & dat$Name != 'Jean', ]

#get two lists of class estUDm
estUDm1 <- kernelUD(d1[ ,'Name'])
estUDm2 <- kernelUD(d2[ ,'Name'])

#unlist for class estuD
estUDm1 <- unlist(estUDm1)
estUDm2 <- unlist(estUDm2)

#concatenate to a new list
tot <- c(estUDm1, estUDm2)

#assign class estuDm
class(tot) <- "estUDm"
tot

This is a bit late, but because class-estUDm is just a list of class-estUD, I believe you can unlist to obtain class-estUD, concatenate these into a new list, then specify the estUDm class. An example below.

library(adehabitatHR)
library(sp)

#example data
data(puechabonsp)
dat <- puechabonsp$relocs
dat$Name <- as.character(dat$Name)

#split into two datasets
d1 <- dat[dat$Name == 'Brock' | dat$Name == 'Jean', ]
d2 <- dat[dat$Name != 'Brock' & dat$Name != 'Jean', ]

#get two lists of class estUDm
estUDm1 <- kernelUD(d1[ ,'Name'])
estUDm2 <- kernelUD(d2[ ,'Name'])

#unlist for class estuD
estUDm1 <- unlist(estUDm1)
estUDm2 <- unlist(estUDm2)

#concatenate to a new list
tot <- c(estUDm1, estUDm2)

#assign class estuDm
class(tot) <- "estUDm"
tot
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文