Hello R-users, I have the following question, for which my search did not really return any usable result. If I have a matrix a1, and a vector a2 like below a1<-matrix(c(1:4),2,2) a2<-c(8,9) is there any function like the expand.grid (or some clever calling of the function) such that it outputs a matrix or dataframe where the entire a1 matrix is repeated for each value of a2 (the rbind and cbind solution is not something that i am after). The desired output is: out= 1 3 8 2 4 8 1 3 9 2 4 9 Thank you in advance and have a great day ahead! Eugen [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.