Question: Using R Programming !!! a
Using R Programming !!!
a<-tibble(id = sample(1:100, 20))
Please use R programming to pick a random 20 from 100 IDs and use the "mutate" function in another column as treatment as YES and NO.
Assign Yes and No with equal probabilities independently for 20 IDs. (50:50)
The example should be like this:
| id | Treatment |
| 34 | Yes |
| 46 | No |
| 23 | Yes |
| 10 | No |
| 5 | No |
Please show the R code!
Besides using probability ratio to split and if else statements, what other option can get the same result?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
