Dear all, if the attachment didn´t arrive, maybe it works now. I would like to substract the "IN" values (= the air which goes into the chambers) for "d13C", "ppm_CO2" and "ppm_13CO2" from the "d13C", "ppm_CO2" and "ppm_13CO2" for every single chamber. I need to substract the "IN" values which were measured *before* the chamber.
So the calculation would look like df$d13C [chambers] - df$d13C [IN] df$ppm_CO2 [chambers] - df$ppm_13CO2 [IN] df$ppm_13CO2 [chambers] - df$ ppm_13CO2 [IN] --> for chamber 101-111 this should be the first "IN" (No 1) --> for chamber 1-11 this should be the second "IN" (No 12) ...and so on I tried sth. like which(abs(date-x) == min(abs(date-x), but it just gives me the closest "IN" in time and not the "IN" before. I would appreciate any help! Thank you so much, Vicci Am Do., 22. Nov. 2018 um 17:53 Uhr schrieb Rui Barradas < ruipbarra...@sapo.pt>: > Hello, > > No attachment arrived. > R-help allows only a limited number of file types to be attached, if you > file is a text file, change its extension to .txt an try again, please. > > Hope this helps, > > Rui Barradas > > Às 09:33 de 22/11/2018, Romy Rehschuh via R-help escreveu: > > Dear all, > > > > I hope this is the right way to ask questions. > > I have a problem with R regarding the detection of the measurement of a > > specific sample_id (see example file attached). I have to substract the > > "IN" values (means the air which goes into the chambers) from the values > of > > "d13C", "ppm_CO2" and "ppm_13CO2" for every single chamber (=sample ID). > > The "IN" values have to be the ones which were measured* before *the > > measurements of the single chambers in time. I measured "IN" once and > then > > up to 10 chambers in a row to safe time, then "IN" again, but it can > change. > > Therefore, searching for the closest "IN" does not work. > > > > Do you have any suggestions? Would it be possible to write a loop for > this? > > I would really much appreciate your help! > > > > Best, Vicci > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > >
No date chamber d13C ppm_CO2 ppm_13CO2 1 10.14.2018 10:43 PM IN -0.192 439.6908 4.9382 2 10.14.2018 10:47 PM 101 -0.058 440.7646 4.9509 3 10.14.2018 10:50 PM 103 -1.368 535.6602 5.9967 4 10.14.2018 10:53 PM 104 -1.601 542.4841 6.0702 5 10.14.2018 10:57 PM 105 -1.353 475.2809 5.3299 6 10.14.2018 11:00 PM 106 -1.184 530.6732 5.9430 7 10.14.2018 11:03 PM 107 -1.582 512.5939 5.7418 8 10.14.2018 11:07 PM 108 -1.359 544.0658 6.0889 9 10.14.2018 11:10 PM 109 -1.557 543.2651 6.0790 10 10.14.2018 11:13 PM 110 -1.638 477.0006 5.3476 11 10.14.2018 11:17 PM 111 -1.475 530.1569 5.9357 12 10.14.2018 11:20 PM IN -0.039 439.3367 4.9350 13 10.14.2018 11:23 PM 1 -0.061 439.7931 4.9400 14 10.14.2018 11:26 PM 3 -0.510 456.0714 5.1201 15 10.14.2018 11:30 PM 4 -0.510 456.5144 5.1250 16 10.14.2018 11:33 PM 5 -0.767 454.4449 5.1005 17 10.14.2018 11:37 PM 6 -0.788 459.7679 5.1600 18 10.14.2018 11:40 PM 7 -0.978 456.6323 5.1240 19 10.14.2018 11:43 PM 8 -0.742 450.4059 5.0556 20 10.14.2018 11:47 PM 9 -0.675 451.6678 5.0700 21 10.14.2018 11:50 PM 10 -0.880 455.5837 5.1127 22 10.14.2018 11:53 PM 11 -0.912 463.0478 5.1960 23 10.15.2018 12:01 AM IN -0.368 439.5525 4.9359 24 10.15.2018 12:12 AM 102 -0.205 439.9343 4.9409 25 10.15.2018 12:15 AM 112 -1.685 474.5002 5.3196 26 10.15.2018 12:19 AM 113 -1.714 474.4248 5.3186 27 10.15.2018 12:22 AM 114 -2.032 496.5623 5.5623 28 10.15.2018 12:26 AM 115 -1.602 471.2034 5.2834 29 10.15.2018 12:29 AM 116 -1.303 554.4268 6.2028 30 10.15.2018 12:32 AM 117 -1.833 501.2357 5.6151 31 10.15.2018 12:36 AM 118 -1.745 496.0126 5.5578 32 10.15.2018 12:39 AM 119 -1.537 467.5305 5.2428 33 10.15.2018 12:42 AM 120 -2.109 507.5778 5.6836
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.