From obnoxious_one at hotmail.com  Wed Jun  4 12:50:07 2008
From: obnoxious_one at hotmail.com (obnoxious_one at hotmail.com)
Date: Wed,  4 Jun 2008 12:50:07 +0200 (CEST)
Subject: [Rd] permsn incorrect when x==m (library: prob) (PR#11571)
Message-ID: <20080604105007.EA4C0282EFF7@mail.pubhealth.ku.dk>

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



[Rd] permsn incorrect when x==m (library: prob) (PR#11571)
obnoxious_one at hotmail.com