Skip to content
Prev 32796 / 63421 Next

Bug in base function sample ( ) (PR#13727)

On Thu, 2009-05-28 at 09:30 +0200, chajewski at fordham.edu wrote:
This is working as documented/intended in ?sample. 'x' is of length 1,
so it is interpreted as 1:x (if x >=1), resulting in the behaviour you
have encountered.

That help page even goes so far as to warn you that this "convenience
feature may lead to undesired behaviour..." and gives an example
function (in Examples) that handles the sort of use case you have. See
the Examples section and the resample() function created there.

HTH

G