permsn incorrect when x==m (library: prob) (PR#11571)
Dear Obby, Thanks. In the future, when you have a question about something that happens in a particular package, keep in mind that it is customary to contact the package maintainer (me), rather than file a bug report with the R developers. In that case, I would have alerted you that this problem has already been found and a fix was posted: please see http://tolstoy.newcastle.edu.au/R/e4/help/08/04/8178.html This will be included in the next release of prob, on which I am currently working. I expect it to be ready by August. Best, Jay
On Wed, Jun 4, 2008 at 6:50 AM, <obnoxious_one at hotmail.com> wrote:
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
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
*************************************************** G. Jay Kerns, Ph.D. Assistant Professor / Statistics Coordinator Department of Mathematics & Statistics Youngstown State University Youngstown, OH 44555-0002 USA Office: 1035 Cushwa Hall Phone: (330) 941-3310 Office (voice mail) -3302 Department -3170 FAX E-mail: gkerns at ysu.edu http://www.cc.ysu.edu/~gjkerns/