Chage value in R : Have ped1.txt and ped2.txt. sep= tab or space

ped1.txt 

    222 333 444
    333 458 458
    458 774 556
    500K lines...
ped2.txt

    222 -12006
    333 -11998

I need to recode numbers in file 1 using key from file 2, for all data.
Result should be like:

    -12006 -11998 444
    -11998    458 458
       458    774 556
    500K lines...
How to do it?
Thanks.
