Hi Again,
Thanks very much for your response. It seems my example got rearranged
(transposed?) after I posted it. Hopefully this example will be more
clear. I have one file (ex. sheet 1) that will have a column for
individuals (ind) and a column for the date (date). I would like to merge
this with another file (ex. sheet 2) that has both the 'ind' and date
column
as well as associated body condition measurements (BC1 and BC2).
My problem: The body condition values were measured intermittently
throughout an individuals history but for our purposes we would like to
treat them as representative of 15 days before and after measurement and
days outside of this window should have NAs (there are other data associated
with those days). When I merge these to files, is there a way to write
these body condition values forward and back 15 days? This would give me
something that looks like sheet 3.
Thank you!
Sheet 1
ind date
1 01/02/87
1 02/02/87
1 03/02/87
1 04/02/87
1 05/02/87
1 06/02/87
1 07/02/87
1 08/02/87
1 09/02/87
1 10/02/87
1 11/02/87
1 12/02/87
1 13/02/87
1 14/02/87
1 15/02/87
1 16/02/87
1 17/02/87
1 18/02/87
1 19/02/87
1 20/02/87
1 21/02/87
1 22/02/87
1 23/02/87
1 24/02/87
1 25/02/87
1 26/02/87
1 27/02/87
1 28/02/87
1 01/03/87
1 02/03/87
1 03/03/87
1 04/03/87
1 05/03/87
1 06/03/87
1 07/03/87
1 08/03/87
1 09/03/87
1 10/03/87
1 11/03/87
1 12/03/87
1 13/03/87
1 14/03/87
1 15/03/87
1 16/03/87
1 17/03/87
1 18/03/87
1 19/03/87
1 20/03/87
1 21/03/87
1 22/03/87
1 23/03/87
1 24/03/87
Sheet 2
ind Date BC1 BC2
1 01/02/87 33 3
1 03/03/87 44 3
Sheet 3
ind date BC1 BC2
1 01/02/87 33 3
1 02/02/87 33 3
1 03/02/87 33 3
1 04/02/87 33 3
1 05/02/87 33 3
1 06/02/87 33 3
1 07/02/87 33 3
1 08/02/87 33 3
1 09/02/87 33 3
1 10/02/87 33 3
1 11/02/87 33 3
1 12/02/87 33 3
1 13/02/87 33 3
1 14/02/87 33 3
1 15/02/87 33 3
1 16/02/87 NA NA
1 17/02/87 NA NA
1 18/02/87 44 3
1 19/02/87 44 3
1 20/02/87 44 3
1 21/02/87 44 3
1 22/02/87 44 3
1 23/02/87 44 3
1 24/02/87 44 3
1 25/02/87 44 3
1 26/02/87 44 3
1 27/02/87 44 3
1 28/02/87 44 3
1 01/03/87 44 3
1 02/03/87 44 3
1 03/03/87 44 3
1 04/03/87 44 3
1 05/03/87 44 3
1 06/03/87 44 3
1 07/03/87 44 3
1 08/03/87 44 3
1 09/03/87 44 3
1 10/03/87 44 3
1 11/03/87 44 3
1 12/03/87 44 3
1 13/03/87 44 3
1 14/03/87 44 3
1 15/03/87 44 3
1 16/03/87 44 3
1 17/03/87 44 3
1 18/03/87 44 3
1 19/03/87 44 3
1 20/03/87 44 3
1 21/03/87 NA NA
1 22/03/87 NA NA
1 23/03/87 NA NA
1 24/03/87 NA NA
On 27 February 2011 20:49, Tal Galili <tal.galili@gmail.com> wrote:
> Hi Grant,
> I don't have a solution, but just to be clearer on your situation:
>
> One row from sheet 2 looks like this:
> BC1 BC2 1 01/02/87 33 3 1 03/03/87 44 3
> ?
>
> Are you using only the first 6 columns for the data to be replicated, and
> using the other columns as some sort of indicators on when a sequence ends?
>
> If so, I would suggest asking the group how you might be able to turn sheet
> 2 so that it will have as many rows as you needs (which you will then merge
> with sheet 1).
>
> And for clarity sake, consider using ?dput for your objects.
> Looking at data the way you pasted them (also, without column names) is not
> very easy for the reader (which might reduce your chances of getting help).
>
> Cheers,
> Tal
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili@gmail.com | 972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
>
----------------------------------------------------------------------------------------------
>
>
>
>
>
> On Sun, Feb 27, 2011 at 6:41 PM, Grant Gillis
<grant.j.gillis@gmail.com>wrote:
>
>> BC1 BC2 1 01/02/87 33 3 1 03/03/87 44 3
>
>
>
[[alternative HTML version deleted]]