Adding GameObject to group of GameObjects

In the unity editor you just drag a game element into another to create a group but how do you do this using the scripting api?

you use the SetParent method of the objects transform to do that.