Let\'s say if I have the following data
x <- rnorm(100)
I want to create another column where where if x is equal to or gre
x
You want to use an Heaviside function. You can find it in the fbasics package, for example.
fbasics
set.seed(42) x <- rnorm(100) library(fBasics) Heaviside(x, 0.2)