# Create a dataframe by fixing rows in one column and repeating other columns

Advertisements Lets say I have three variables: var1<-c(101,102,103,104) var2<-c("AB","XY") var3<-c(1,2) X<-expand.grid(var1,var2,var3) X Above code gives this output Var1 Var2 Var3 1 101 AB 1 2 102 AB 1 3 103 AB 1 4 104 AB 1 5 101 XY 1 6 102 XY 1 7 103 XY 1 8 104 XY 1 9 101 AB… Read More Create a dataframe by fixing rows in one column and repeating other columns