I'm trying to write a simple recursive function in R which each time will return just a single number. I want to store these in a column basically. So initially I'm declaring something like
relevant=c(rep(0,16))
then if it satisfies some criteria I want to change the corresponding values of
relevant[j] to 1.
if(something==1){
relevant[j]=1
}
But then when I call relevant outside the function all the values are 0. The criteria is definitely being satisfied, but it just doesn't seem to change the values!
Any help would be appreciated!
Here is a "simple enough recursive function" that will return a vector of numbers, each one being calculated inside the function:
Is that what you had in mind ?