You should look in to help page of sample
function
?sample
shows :
Usage
sample(x, size, replace = FALSE, prob = NULL)
where
prob
A vector of probability weights for obtaining the elements of the vector being sampled.
and further below in Details you will see
The optional prob argument can be used to give a vector of weights for obtaining the elements of the vector being sampled. They need not sum to one, but they should be non-negative and not all zero.
So to answer your question, apart from read the manual , use prob=c(0.1,0.9)
if you want probability of 0.1 for first element of x
and 0.9 for the second.