u_sub_c = function(x, c){ y = rep( NA, length(x) ) y[ x < c ] = 0 y[ x >= c ] = 1 return(y) }