HI,

You can also try this:
d<-1:25
A<-sample(combn(20:30,2))
B<-sample(combn(20:30,2))
lapply(d,function(x) matrix(c(1,A[x],B[x],1),2,2))
[[1]]
     [,1] [,2]
[1,]    1   23
[2,]   27    1

[[2]]
     [,1] [,2]
[1,]    1   21
[2,]   21    1

[[3]]
     [,1] [,2]
[1,]    1   29
[2,]   23    1

[[4]]
     [,1] [,2]
[1,]    1   25
[2,]   20    1

[[5]]
     [,1] [,2]
[1,]    1   23
[2,]   28    1
------------
-----------
[[24]]
     [,1] [,2]
[1,]    1   24
[2,]   26    1

[[25]]
     [,1] [,2]
[1,]    1   22
[2,]   22    1

A.K.




______________________________________
If you reply to this email, your message will be added to the discussion below:
http://r.789695.n4.nabble.com/sapply-and-matrix-command-tp4637769p4638821.html
This email was sent by arun kirshna (via Nabble)
To receive all replies by email, subscribe to this discussion: 
http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=subscribe_by_code&node=4637769&code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDYzNzc2OXwtNzg0MjM1NTA4
        [[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.

Reply via email to