[R] Insert rows into a pre-existing data frame

Mark Brewster markbbrewster at gmail.com
Fri Mar 25 18:04:54 CET 2011


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.



More information about the R-help mailing list