Question: what is gl function in r?
Answer: R gl. gl() function generates factors by specifying the pattern of their levels. relevel() funtion re-orders levels of a factor so that the level specified by ref is first and the others are moved down. This is useful for contr. treatment contrasts which take the first level as the reference.