ILM Special effects supervisor Scott Farrar said that R2-D2 had a cameo in Transformers 2. My bet was that he was behind Megan Fox's ass at one point, giving her a back rub. With his special back vibrating thingapparatus. Updated.
Actually, according to this frame captured from the Blu-ray edition, our favorite astromech appears 2 hours 17 minutes and 52 seconds in the movie, during the merge of Jetfire's parts to Optimus Prime.
It looks like the real thing to me. Those look like his three feet, as he is flying away from the camera. They are too symmetric to be a piece of random metal, and I can see his shape. But then again, I've been wrong before.
Update: A reader sent us this other frame, which clearly shows that's R2-D2. [Transformers Live]