Initialize vector using the ifelse function in R

Hi,

I agree with @Yarnabrina that the functions you are using are a bit odd. Also, there are missing parameters like the function "h(), g()" and the variable "S1".

Try to create a reprex so we can better work with your code. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

Good luck,
PJ