From ripley@stats.ox.ac.uk  Sun Feb 23 09:53:02 2003
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Sun Feb 23 09:53:02 2003
Subject: [Rd] Re: error from sample if sampling length one character (PR#2546)
Message-ID: <200302230852.h1N8qn35011712@pubhealth.ku.dk>

> Sample gives an error if it is sampling a length one character
> vector:
>
> > sample('a', 1)
> Error in sample(x, size, replace, prob) : invalid first argument

>From the help page:

       x: Either a (numeric, complex, character or logical) vector of
          more than one element from which to choose, or a positive
          integer.

so this is as documented, hence not a bug.

[Re-created from the R-bugs page as my mail server is offline.]

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Re: error from sample if sampling length one character (PR#2546)
ripley@stats.ox.ac.uk