Well, Luke couldn't understand R2's "language" on his own. He either needed 3PO to translate for him or to read R2's beeps and whistles through the translator on his X-Wing. Luke never told R2 why they were going to Dagobah while they were in the ship and by the time Luke mentions Yoda by name they were already out of the ship and had made camp. Also 3PO did not accompany them on that trip, so there's definitely "wiggle room" there to make sense of R2's silence.
Aside from that, I just assumed R2 was simply wise to the whole situation and understood that it was in the best interest for ALL parties not to say anything. If you remember, he didn't say anything to Luke on Tattooine about who Obi Wan was or why it was important to get his message to Princess Leia either. Hell, besides Yoda and Obi Wan, R2D2 was probably the wisest character in the entire saga!