I have a vector A which contains zeros and ones. I would like to randomly change n percent of the ones to zero. Is this the best way to do it in R (10% change):

```
for (i in 1:length(A)) 
{
    if(A[i] > 0)
    {
        if(runif(1) <= 0.1)
        {
            A[i] = 0
        }
    }
}

```

Thanks.