I posted an answer to a question which was completely wrong. It was (I believe) sane, well-reasoned, formatted, and so on, but it answered a slightly different question to the one asked.
The original poster pointed out my elementary comprehension mistake in a comment, and it was immediately obvious to me that this was indeed the case. I upvoted the comment and then deleted my answer.
I then wondered if that is an ok thing to do? Maybe someone else would think of answering the same way, and the presence of a massively downvoted answer (mine) would prevent them doing so. Maybe it is somehow unethical here to hide your mistakes in this way?
Any clarification on this matter is gratefully received.