[Rd] permsn incorrect when x==m (library: prob) (PR#11571)
obnoxious_one at hotmail.com
obnoxious_one at hotmail.com
Wed Jun 4 12:50:07 CEST 2008
Full_Name: Obnoxious
Version: 2.7.0
OS: Windows
Submission from: (NULL) (121.223.77.238)
Objective:
Generate all permutations of the elements of x taken m at a time.
Library:
prob
Function:
permsn
Issue:
Does not appear to be working correctly when x==m.
Example:
libary(prob)
permsn(2,1) i.e., x > m
#Gives the correct result of
[,1] [,2]
[1,] 1 2
#Yet
permsn(2,2) i.e., x==m
#Gives the incorrect? result of
[1] 1 2
#Shouldn't the result be
[,1] [,2]???
[1] 1 2???
[2] 2 1???
#Workaround:
permsn(3,2) i.e. permsn(x+1,m)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 2 1 3 2 3
[2,] 2 1 3 1 3 2
#but then we have to remove the results with x==3 in them
#hope that all makes sense
Thankyou,
Obby
More information about the R-devel
mailing list