Dear R-users,
Is there an easy way to determine all possible vectors of length 21 with
each entry having permutations from 0 to 4, instead of doing it like this?
It really takes up too much time, and I am convinced that there exists
something easier.
Can you help me? Thank you in advance!
Kind regards,
Elke
for (a in 0:4){
for (b in 0:4){
for (c in 0:4){
for (d in 0:4){
for (e in 0:4){
for (f in 0:4){
for (g in 0:4){
for (h in 0:4){
for (i in 0:4){
for (j in 0:4){
for (k in 0:4){
for (l in 0:4){
for (m in 0:4){
for (n in 0:4){
for (o in 0:4){
for (p in 0:4){
for (q in 0:4){
for (r in 0:4){
for (s in 0:4){
for (u in 0:4){
for (v in 0:4){
vec<-list(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v)
write.table(vec,file="C:/Documents and Settings/My
Documents/permutations.txt",sep=";",col.names=FALSE, row.names=FALSE,
append=TRUE)
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
____________________________
Elke Moons, PhD
Transportation Research Institute/
Instituut voor Mobiliteit (IMOB)
Wetenschapspark 1, bus 15
3590 Diepenbeek
BELGIUM
Tel. +32-11-26.91.26
Fax. +32-11-26.91.99
E-mail:
elke.moons@...
[[alternative HTML version deleted]]
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.