# NOT RUN {
x <- as.logical(rvbern(1,0.5)) # Bernoulli rv
is.numeric(x) # FALSE
x <- as.numeric(x) # coerce to numeric; all TRUEs become ones, FALSEs zeros
is.numeric(x) # TRUE
# }
Run the code above in your browser using DataLab