Adding values to the end of a vector?
why not :
x<-vector()
for (i in 1:5) { x <-c(x,i) }
x
[1] 1 2 3 4 5
for (i in 1:5) { x <-c(x,i) }
x
[1] 1 2 3 4 5 1 2 3 4 5
On Tuesday 04 January 2005 14:57, Ingmar Visser wrote:
x=numeric(0)
for(i in 1:5) {
+ x[length(x)+1]=i + }
x
------------------------------------------------------------ Tristan LEFEBURE Laboratoire d'?cologie des hydrosyst?mes fluviaux (UMR 5023) Universit? Lyon I - Campus de la Doua Bat. Darwin C 69622 Villeurbanne - France Phone: (33) (0)4 26 23 44 02 Fax: (33) (0)4 72 43 15 23