I'm trying to add a number to a vector if it passes a test. Why is this not working? I'm using R.
good_vect <- ifelse(passed_assump1==TRUE&passed_assump2==TRUE&strong==TRUE&self_sust==TRUE,c(good_vect,strat_num),c(good_vect))
or
valuable_strat_vect <- ifelse((master_strat_vect[13*j])>=cutoff_coop_ratio,c(valuable_strat_vect,j),c(valuable_strat_vect))
It spits out this error:
Error in ifelse((master_strat_vect[13 * j]) >= cutoff_coop_ratio, c(valuable_strat_vect, :
replacement has length zero
In addition: Warning message:
In rep(no, length.out = length(ans)) :
'x' is NULL so the result will be NULL