Retake as A or keep the B?

I am not talking about “dropping” a class. I am not talking about withdrawing from a class.

I am talking about when you completely finish the class, and get a grade of B, then you retake the class for an A. Unlike withdrawal, you are not granted a refund, because you are just taking the same class twice.

How would that look on transcript? Basically retaking a class doesn’t count the original grade for GPA, but still appears on transcript with as an “R”, but this is different than a “W” which would be withdrawal.