04pallav
9/13/2017 - 9:21 PM

expand.grid

expand.grid

expand.grid() function creates a data frame from all combinations of the supplied vectors or factors.

subtype <- c("green","red","yellow")
height <- c("3.2","2.5","6.1")
sex <- c("M","F","F")
expand.grid(subtype,height,sex)