[R] Sample function in R

R. Michael Weylandt michael.weylandt at gmail.com
Sun Feb 12 19:25:29 CET 2012


sessionInfo()?

Can you replicate this behavior in a R --vanilla session? This seems
very odd and I presume you've overwritten sample() somewhere in your
workspace.

Michael

On Sun, Feb 12, 2012 at 12:52 PM, SUPAKORN LAOHAPITAKVORN
<klangklang2002 at gmail.com> wrote:
> Hi,
> Can anyone help me with the sample () in R?
>
> If I sample from x, I should get one integer.  Can anyone tell me what's
> wrong here?
>> x =1:12
>> sample(x)
> [1] 6.5
>
> And, I cannot get the sample with size = 2
>> sample(x, size = 2)
> Error in sample(x, size = 2) : unused argument(s) (size = 2)
>> sample(x, 2)
> [1] 54.16667
>
> Thank you in advance
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list