How can i change the values inside a continous variable? For example i have different values for the variable number and i want to change it as follows: if number>1000 ---> change the value of that observation to 0, otherwise change to 1
You can use ifelse
x <- 1000*rnorm(10)
ifelse(x > 1000, 0, 1)
1 Like
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.