When R5-D4 breaks down, Luke says, "There's something wrong with this R2 unit!"
Note that the droid's name is R5-D4, not R2-D4. R5-D4 is not an R2 unit. Luke should've said, "Something's wrong with this astromech droid!" That's more accurate.
You must remember young one, that Luke is just a naive little farm boy at this point. He might know a little about Androids and could have gotten confused
Actually, any R2-looking unit (R1, R2, R3, R4, R5, R6, and R7) is refered to (in slang) as an R2. This is because the P2 and R1 units were failures, leading up to the major success of the R2 unit. When the R2 unit became popular, people probably just called them R2's, and when the new units were released, they probably didn't know and just assumed they were a different version of the R2's. And I think the whole Luke is a farmboy, how would he know anything about droids, is true. He was worrying about vaporators and T-16 scyhoppers (maybe even a little X-wing action). He really shouldn't be thinking about astromechs unless he wanted to know which one is the best to use on your starfighter.
Luke maybe a naive farmboy but he should know a thing or two about droids. C3PO falls and brakes apart from the Tuskin Raider scene and Luke fixes him up at OB1's place. Luke cleaning up R2 says, "there's alot of carbon scoring... and you have something jammed in here real good". How does Luke know that "jammed" part doesn't belong in a R2 unit unless he's worked on one before. Also, Luke asked Owen if he could join the academy this year because, "there's more than enough droids" on the farm. So, this IS a slip-up when Luke says, "this R2 has a bad motivator". And how did this R5D4 unit make it's way onto one of the x-Wing at the battle of Yavin?