This is my first post :) Thank you so much in advance.
I am trying to simulate data in R I already have simulated my data set. However, now I need to create new variables that meets a condition for example:
dataTFULL2$RANDOM100[dataTFULL2$Variable1-dataTFULL2$Variable2 > 0] <- 1
dataTFULL2$RANDOM100[dataTFULL2$Variable1-dataTFULL2$Variable2 < 0] <- 0
With that code I can create the variable that meets the condition for 100% and 0% of the cases. But I need to do it in the same way for the 95%, 90%, 85%, 80%....5%.
I am stuck with this but there must be a way to compute that condition to be meet in a specific % of the cases.