我的问题是我想通过这段代码获得配对: for(i in 1:4){for(j in 1:4){print(pair(i,j)) }}
我的预期结果是(1,1),(1,2)....不是(1L,1L),(1L,2L)
发布于 2018-05-31 16:25:24
我假设你的意思是pairlist
不是pair
。
如果是这样你可以做到以下几点:
v <- list(pairlist(1,2),pairlist(3,4))
if (any(sapply(v,identical,pairlist(1,2))))
print(1)
# [1] 1
if (any(sapply(v,identical,pairlist(2,2))))
print(1)
# *nothing happens*
https://stackoverflow.com/questions/-100004671
复制相似问题