I would like to take many values from interpolation at once. For example, from my data file('int.txt'), I have each "conc1" corresponding to each "depth1" (e.g., 1.1 m, 2.1 m, 3.1 m, 4.1 m, 5.1 m, 6.1 m).
Here, after interpolating my concentration data, I want to take "conc"s at "depth" of 1.2, 2.2, 3.2, 4.2, 5.2 m Following comments below (I'm editting my question), I made a code like this,
f = approxfun(depth1, conc1, rule=1,method='linear', xout=seq(1.2,5.2,1.0))
i<-approx(depth1, conc1, rule=1,method='linear', xout=seq(1.2,5.2,1.0))
It works well. Here, I have two more questions. 1. Then, how can I make two columns with data from i? Can I add these two columns to my data, 'int'? In this case, I will have no value at the last rows of the new columns. 2. I have one more x, y vector (y= conc2, x=depth2). I have each "conc2" at each "depth2", and "depth2" does not have regular intervals, so which is like 1.3, 2.7, 3.2... Here, after interpolating above, I want to extract all "conc1" values corresponding "depth2". Please let me know how to do these things. Thank you very much for your help :)