-1

my problem is i'm trying to get pairs by this code:
for (i in 1:4) { for (j in 1:4) { print(pair(i,j))
} }

my expected result to be (1,1),(1,2).... not (1L,1L),(1L,2L)

1 Answers1

0

-- answer to question before edit --

I'm assuming you mean pairlist and not pair.

If so you can do the following:

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*
moodymudskipper
  • 42,696
  • 10
  • 102
  • 146