Also, modified from Prof Brian Ripley's post 
https://stat.ethz.ch/pipermail/r-devel/2006-July/038551.html here ,

idx<- 2
df3<- df1[c(1:idx,idx,(idx+1):nrow(df1)),]
df3

df3[idx+1,]<- NA  #or whatever values you want
df3




--
View this message in context: 
http://r.789695.n4.nabble.com/Insert-rows-into-a-pre-existing-data-frame-tp864111p3405898.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