[R] inserting elements in a list

Agustin Lobo alobo at ija.csic.es
Mon Feb 17 13:51:02 CET 2003


I've searched the doc for insert
and could not find the way to do the following,
hope someone can help:

Let's say we have a vector:
> a
[1] "1" "2" "3" "5" "6" "3"

and we want to insert a "7" after
any given "3", i.e., we want vector a 
to become:

[1] "1" "2" "3" "7" "5" "6" "3" "7"

That is, how can we replce one
element by more than one elements?
(...causing the vector to go beyond its
length)

Thanks

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es




More information about the R-help mailing list