error from sample if sampling length one character (PR#2546)
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