<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<font size=+1>hi R-help!</font><font size=+1></font>
<p><font size=+1> I would like to know a simple and easy
way (if posible) to do the following data manipulation. I have a matrix
of experimental data (with replicae in time)</font><font size=+1></font>
<p><font size=+1>>experiment<-data.frame(times=c(0,0,10,10,20,20,30,30),expval=c(1,1,2,2,3,3,4,4))</font>
<br><font size=+1>> experiment</font>
<br><font size=+1> times expval</font>
<br><font size=+1>1 0
1</font>
<br><font size=+1>2 0
1</font>
<br><font size=+1>3 10
2</font>
<br><font size=+1>4 10
2</font>
<br><font size=+1>5 20
3</font>
<br><font size=+1>6 20
3</font>
<br><font size=+1>7 30
4</font>
<br><font size=+1>8 30
4</font><font size=+1></font>
<p><font size=+1>and a set of simulated values</font><font size=+1></font>
<p><font size=+1>> simul<-data.frame(times=c(0,10,20,30),simul=c(3,4,5,6))</font>
<br><font size=+1>> simul</font>
<br><font size=+1> times simul</font>
<br><font size=+1>1 0 3</font>
<br><font size=+1>2 10 4</font>
<br><font size=+1>3 20 5</font>
<br><font size=+1>4 30 6</font><font size=+1></font>
<p><font size=+1>From this simulated data, I would like to obtain a data
frame like this</font><font size=+1></font>
<p><font size=+1> times expval simul</font>
<br><font size=+1>1 0
1 3</font>
<br><font size=+1>2 0
1 3</font>
<br><font size=+1>3 10
2 4</font>
<br><font size=+1>4 10
2 4</font>
<br><font size=+1>5 20
3 5</font>
<br><font size=+1>6 20
3 5</font>
<br><font size=+1>7 30
4 6</font>
<br><font size=+1>8 30
4 6</font><font size=+1></font>
<p><font size=+1>expanding each of the simulated values as many times as
duplicates (triplicates or anything) I have in the data. I have come across
duplicate and match, but I don't see a way forward from here, unless I
make a for loop and I match row by row the time vectors. I am sure that
is a very easy thing, and I apologize in advance for the stupid question,
but I am kind of stuck.</font><font size=+1></font>
<p><font size=+1>cheers,</font><font size=+1></font>
<p><font size=+1>IOsu</font>
<br><font size=+1></font>
<br><font size=+1></font>
<br><font size=+1></font> </html>