Try this: newX <- rbind(unique(transform(x, TIME = 0, CONC = 0)), x) newX[order(newX$VAR),]
On Fri, Mar 11, 2011 at 9:28 AM, <kyle.landskro...@actelion.com> wrote: > Can someone help with a fairly simple task? > I have a data set where I would like to insert a 0 time event between > individuals: > > what I have: > > VAR DATE TIME CONC COVAR > 1 NOV2 0.25 10 group1 > 1 NOV2 0.5 20 group1 > 1 NOV2 1 5 group1 > 1 NOV2 2 1 group1 > 1 NOV2 3 0.1 group1 > 2 NOV2 0.25 10 group2 > 2 NOV2 0.5 20 group2 > 2 NOV2 1 5 group2 > 2 NOV2 2 0.5 group2 > 2 NOV2 3 0.01 group2 > . > . > 1000 NOV2 3 10 group2 > > > ...to what I would like to have: > VAR DATE TIME CONC COVAR > 1 NOV2 0 0 group1 > 1 NOV2 0.25 10 group1 > 1 NOV2 0.5 20 group1 > 1 NOV2 1 5 group1 > 1 NOV2 2 1 group1 > 1 NOV2 3 0.1 group1 > 2 NOV2 0 0 group2 > 2 NOV2 0.25 10 group2 > 2 NOV2 0.5 20 group2 > 2 NOV2 1 5 group2 > 2 NOV2 2 0.5 group2 > 2 NOV2 3 0.01 group2 > . > . > 1000 NOV2 0 0 group2 > 1000 NOV2 3 10 group2 > > Any help would be appreciated. > Thanks, > Kyle > > > The information of this email and in any file transmitted with it is > strictly confidential and may be legally privileged. > It is intended solely for the addressee. If you are not the intended > recipient, any copying, distribution or any other use of this email is > prohibited and may be unlawful. In such case, you should please notify the > sender immediately and destroy this email. > The content of this email is not legally binding unless confirmed by > letter. > Any views expressed in this message are those of the individual sender, > except where the message states otherwise and the sender is authorised to > state them to be the views of the sender's company. For further information > about Actelion please see our website at http://www.actelion.com > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ 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.