Message-ID: <200501041513.01992.lefebure@univ-lyon1.fr>
Date: 2005-01-04T14:13:01Z
From: Lefebure Tristan
Subject: Adding values to the end of a vector?
In-Reply-To: <BE005F4A.7F1%i.visser@uva.nl>
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