In the last episodes of season 6 of Star Wars: The Clone Wars, R2-D2 actually visits Dagobah with Yoda during Yoda's trials to learn the art of maintaining one's individuality in the cosmic force after death. So in answer to this question, yes, R2-D2 and Yoda have met before. Why doesn't he remember Yoda or Dagobah? More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.