Dear R users,
I have a vector of length n and I want to insert some elements (in my case
the NA string) into a defined positions. For example, my vector is z1 and I
want to add NA's in positions 4, 6 y 7 so after that, my new vector, z2,
should have a length of 10+3. 

  z1 <- 1:10
  id <- c(4,6,7)

  # And z2 should be: 
  z2 <- c(1,2,3,NA,4,5,NA,NA,6,7,8,9,10)

Anyone knows how can I do that?
Thank you.

-----
Manuel Ramón Fernández
Group of Reproductive Biology (GBR)
University of Castilla-La Mancha (Spain)
mra...@jccm.es
-- 
View this message in context: 
http://old.nabble.com/Insert-elements-into-a-vector-in-a-defined-positions-tp26520841p26520841.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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