system
Given the following post, respond as if you're commenting on Reddit:
human
[Star Wars] When and Why did R2D2 separate from Anakin Skywalker?

When Anakin went on his rampage, R2D2 was no longer by his side. Did the droid make a moral choice to not accompany Anakin any longer, or was Artoo assigned to someone else just prior to Anakin's betrayal?
gpt
He's there in Revenge of the Sith.

R2 went with Anakin to Mustafar to wipe out the Separatist Council. Anakin told him to stay with the ship as he went inside to carry out the order.

After Anakin choked out Padme and began his duel with Obi-Wan, R2 and C3PO took Padme inside her ship. When Obi-Wan returned he took both droids and Padme to Polis Massa to meet up with Yoda and Bail and witness Padme giving birth. Afterwards he and C3PO entered into Bail Organa's service.