Sexing can be done at any age. If babies are sexed very early, it is best to confirm the sex at about two weeks. Boars MUST be separated from their mother at 3 to 4 weeks weeks if they are normal and healthy, 4 weeks only if they need an extra health boost and are showing no signs of mounting behavior.
Never leave a boar with his mother or sisters longer than 4 weeks. The traditional "Y" and "i" method can be confusing. Make sure to use several "signs" to confirm the correct sex. If you are at all unsure about the sex, do NOT take your pig to a pet store to ask them. There are many documented stories of vets missexing guinea pigs. Make sure you go to a vet who really knows what they are looking at.
The life of your guinea pig could depend on it. The vagina is normally closed by a membrane hymen except during estrus heat and at parturition birthing. It actually dissolves "mucousy" when they go in heat and will reseal itself afterwards. Sows come 'into cycle' every days for 24 to 48 hours.
If you have one or more male guinea pigs, you should be checking their genital area regularly about once a week or every other week. Fully extrude the penis and make sure it looks clean and healthy. Sometimes a strand of hay will get caught and cause problems. Or it can get gunked up. Clean it gently with warm water if necessary.
Also, check the anal area to make sure there is no sign of blockage or impaction. See this link for more information. The sows usually have a smooth swelling over their genital area. Sometimes, it can be bumpy looking, making you think it might be a male! If you gently part the genital opening, on a sow, a "Y" shaped opening should appear. Press gently just above the genital area.
If it's a male, you should be able to make the penis slowly extrude. Don't be fooled by appearances. Sometimes, it doesn't look like there is a penis there at all! Especially in heavy, older males, the penis can be "tucked away" in folds of skin, looking entirely like a female! You should TRY to get the penis to ease out. If it is a male, you can usually feel the inner part of the shaft which is under the skin in the same area--just above the genitals -- by very gently pressing and rubbing your finger over that area.
You will feel a "ridge" just above the penis. Also, if there is a pucker or protrusion of skin at the top of the genital area, then that is a good indication that there is a penis tucked away underneath. But, be sure to get it to extrude to confirm it. Young males have a donut shape around their rectum where their testicles are.