Closed RobinHankin closed 1 year ago
Issue #45 was somewhat misleading: the problem above was caused by the fact that rperm()
returns a word, and as.character()
was doing its best to coerce an integer matrix to character. In any event, this needs to be documented. Observe:
> a <- rperm()
> a
[1] (16475)(23) (12374)(56) (12563)(47) (134)(27) (157)(34)
[6] (1352467) (1732456) (156)(23)(47) (256734) (16723)
[coerced from word form]
> as.character(a)
[1] "6" "2" "2" "3" "5" "3" "7" "5" "1" "6" "3" "3" "5" "7" "2" "4" "4" "3" "5"
[20] "3" "2" "7" "1" "4" "4" "5" "2" "2" "4" "1" "7" "1" "7" "1" "3" "6" "5" "7"
[39] "2" "4" "1" "6" "6" "5" "7" "2" "6" "6" "6" "5" "4" "5" "3" "6" "6" "7" "1"
[58] "1" "7" "7" "5" "4" "4" "2" "1" "1" "3" "4" "3" "2"
> as.character(as.cycle(a))
[1] "(1,6,4,7,5)(2,3)" "(1,2,3,7,4)(5,6)" "(1,2,5,6,3)(4,7)"
[4] "(1,3,4)(2,7)" "(1,5,7)(3,4)" "(1,3,5,2,4,6,7)"
[7] "(1,7,3,2,4,5,6)" "(1,5,6)(2,3)(4,7)" "(2,5,6,7,3,4)"
[10] "(1,6,7,2,3)"
>
Fixed in 5e55399
Look:
I would expect
as.character()
to return something likeWe should use the return value of
print.cycle()
.