Here is the simplified version:
Suppose I am using 'which' function to find a position, say -
position_num=which(df$word=="ABC")
If the value exists it is fine and it returns an integer, but in case it is unable to match it returns integer(0)
in such a case I want to assign a default value to position_num=1.
Thanks for the help in advance