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

	[[alternative HTML version deleted]]

