On Sun, Feb 12, 2012 at 01:57:18PM -0500, SUPAKORN LAOHAPITAKVORN wrote:
> This is what I got:
>
> > sessionInfo()
> R version 2.14.1 (2011-12-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_
Supakorn,
Try:
rm(sample)
#then
sample(x)
Etienne
2012/2/12 SUPAKORN LAOHAPITAKVORN
> This is what I got:
>
> > sessionInfo()
> R version 2.14.1 (2011-12-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.
This is what I got:
> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
Hi,
The following is what I get:
> x =1:12
> x
[1] 1 2 3 4 5 6 7 8 9 10 11 12
> sample(x)
[1] 9 6 12 5 3 4 1 11 8 7 10 2
> sample(x, size = 2)
[1] 9 4
What's the output of sessionInfo() and ls() ? Perhaps you have a
different "sample" function in your workspace?
HTH,
Jorge
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
wrote:
> Hi,
> Can anyone help me with the sample () in R?
>
> If
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
On 2011-02-19 10:32, Hongwei Dong wrote:
Hi, R users,
I'm wondering if there a way in R I can select cases based on a probability
vector. if a case is selected, that case is marked as 1, otherwise, 0.
For example:
x<-12:18
y<-1:7
sample(x,2,replace=FALSE,y)
I got:
[1] 15 17
What I want to s
Hi, R users,
I'm wondering if there a way in R I can select cases based on a probability
vector. if a case is selected, that case is marked as 1, otherwise, 0.
For example:
x<-12:18
y<-1:7
sample(x,2,replace=FALSE,y)
I got:
[1] 15 17
What I want to see is:
[1] 0 0 0 1 0 1 0
Thanks.
Gary
8 matches
Mail list logo