Hologic Inc. of Bedford, Mass., has entered into an agreement to buy R2 Technology Inc. of Sunnyvale, Calif., for $220 million in common stock. The latter company develops and commercializes computer-aided detection equipment for the diagnosis of breast cancer. Hologic is a developer, manufacturer and supplier of diagnostic and medical imaging technology for digital radiography and breast imaging.