I have a numeric variable where values range from ~20 to ~40 and are continuous.
To samples falling below the cut-off (38) I would like to assign TRUE
, and to all higher numbers FALSE
. For example,
x = c(20, 40, 35, 40)
...should result in:
c(TRUE, FALSE, TRUE, FALSE)
Can anyone give me a suggestion for how to do this in R?
samples <- c(20,40,20,40,38)
dummyVar <- samples < 38
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With