1
我想用附加()后,以确定在一块土地上的数据连接,但我有离开我的功能之前,拆下问题:使用识别和功能
f = function(x, y, data) {
attach(data)
plot(x, y)
ids = identify(x, y)
detach(data)
return ids
}
返回值:
<environment: 0xf785ed8>
attr(,"name")
[1] "data"
> class(i1)
[1] "environment"
> str(i1)
<environment: 0xf785ed8>
- attr(*, "name")= chr "data"
如何在函数中使用attach和identify并返回附加对象的id?
不知道这是你的问题的根源,但' return ids'应该是'return(ids)'。 – nrussell
或者只是'ids' .. –
如果你只是完全避免了'attach' /'detach'会怎么样? –