On Jun 2, 2005, at 01:23 pm, Dimitris Rizopoulos wrote:

try this:

h <- rep(3:2, c(4, 3))
############
n  <- 10
matrix(rep(h, n),  nrow = n, byrow = TRUE)



Hi

outer() also works:


> h <-rep(c(3,2),c(4,3))
> outer(rep(1,8),h)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]    3    3    3    3    2    2    2
[2,]    3    3    3    3    2    2    2
[3,]    3    3    3    3    2    2    2
[4,]    3    3    3    3    2    2    2
[5,]    3    3    3    3    2    2    2
[6,]    3    3    3    3    2    2    2
[7,]    3    3    3    3    2    2    2
[8,]    3    3    3    3    2    2    2
>

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
 tel  023-8059-7743

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to