Skip to content
Prev 178198 / 398506 Next

deleting rows provisionally

Hi. Thanks very much for the reply and the good suggestion. It works well.
But I don't get why the for loop is not deleting anything or making any
assignments? Or I should say, doesn't answer3[-i,] delete entries from
answer3 when the if condition is true?
Also, in your first solution 
answer2[-(answer2[,1]==answer2[,2]),]   

can I say that you are indexing answer2 by answer2[,] and all of the
deletion is coming in the first argument and specifically you are deleting
every entry in answer2 where the first elements of the first and second
columns are the same.
So for example, 
if I wanted instead to switch the elements of the first and second column
whenever they are different what would I do? confused.
Ben Bolker wrote: