[R] Create values based on a table of conditions

2013-03-29 Thread Cat Cowie
Hi R help forum,

I have a simple data frame of four columns - one of numbers (really a
categorical variable), one of dates and one

of data. I have over 500,000 data points to work with, spread over 40
files, each named after a different animal.

These are contact data recorded by proximity loggers over two years
between the animals of the file name and

collars being worn by other animals. The collar may have been worn by
more than one different animal in the study period.

So for example...

filename: RD2

And the data looks like:

(I'm sorry here, dput(head(RD2, 200)) was outputting all the times,
such that it was too large for the console, so I just used head() )

 head(RD2, 200)
encounter_id   date encounter_start encounter_length
1 15 22/06/201122:21:45   20
2 10 04/07/201104:18:571
3 10 04/07/201104:23:121
4 15 08/07/201102:02:30   23
5 15 08/07/201102:03:26  264
6 15 08/07/201102:09:20   35
7 15 08/07/201102:10:25  173
8 15 08/07/201102:13:40   65
9 15 08/07/201102:15:12   47
1015 08/07/201102:17:16   65
1115 08/07/201102:39:10   54
1215 14/07/201102:20:271
1315 14/07/201102:23:356
1415 14/07/201102:25:521
1515 14/07/201102:26:17   39
1615 14/07/201102:28:36   31
1760 14/07/201102:41:561
1860 14/07/201102:42:301
1960 14/07/201102:43:30   36
2060 14/07/201102:45:381
2160 14/07/201102:46:07   15
2260 14/07/201102:46:59   11
2352 14/07/201102:57:43   97
2412 09/08/201122:13:421
2541 18/08/201102:53:181
2641 19/08/201100:57:461
2741 19/08/201101:59:171
2841 19/08/201102:06:16   21
2941 19/08/201102:08:501
3041 19/08/201102:09:26   29
3150 19/08/201102:19:311
3250 19/08/201102:20:201
3350 19/08/201102:20:541
3450 19/08/201102:21:25   25
3550 19/08/201102:22:17   20
3650 19/08/201102:23:00   10
3750 19/08/201102:25:101
3850 19/08/201102:25:541
3950 19/08/201102:26:50   75
4050 19/08/201102:29:531
4150 19/08/201102:30:416
4250 28/08/201119:32:471
4350 28/08/201119:36:38   10
4439 30/08/201122:13:141
4552 13/09/201120:04:57   17
4620 18/09/201100:32:438
4717 02/10/201109:10:18   52
4817 02/10/201109:15:491
4917 02/10/201109:17:191
5025 03/10/201117:16:206
5141 05/10/201104:04:351
5252 07/10/201122:59:57   45
5362 16/10/201118:33:036
5452 28/10/201115:19:471
5541 28/10/201119:00:248
5617 03/12/201117:38:082
5717 03/12/201117:38:49   20
5817 20/05/201219:45:17   17
5917 20/05/201219:45:58   47
6017 22/05/201223:12:541
6117 22/05/201223:15:153
6217 22/05/201223:15:407
6317 22/05/201223:16:09   40
6417 22/05/201223:36:303
6517 22/05/201223:37:29   10
6617 22/05/201223:39:171
6717 23/05/201220:44:01   15
68 6 17/07/201204:25:298
6953 17/07/201223:53:012
7053 24/07/2012

Re: [R] Create values based on a table of conditions

2013-03-29 Thread John Kane
I must be blind but I don' see any link between the two files.  RD2 seems to 
give some kind of encounter data in length of time.  allocate gives the time 
that an animal was wearing a collar ?  

If each file belongs to a specific animal (am I reading this correctly) what 
does it matter what the collar was?  Or is there something in the RD2 file that 
gives a clue to other collars ?

I must be missing the point completely but I don't understand why you want to 
know who was wearing what at what time from the data you have presented.  

BTW , nice presentation of the sample data however dput (head(RD2, 200)) would 
have been even better than head(RD2, 200).

John Kane
Kingston ON Canada


 -Original Message-
 From: cat.e.co...@gmail.com
 Sent: Fri, 29 Mar 2013 18:49:45 +0800
 To: r-help@r-project.org
 Subject: [R] Create values based on a table of conditions
 
 Hi R help forum,
 
 I have a simple data frame of four columns - one of numbers (really a
 categorical variable), one of dates and one
 
 of data. I have over 500,000 data points to work with, spread over 40
 files, each named after a different animal.
 
 These are contact data recorded by proximity loggers over two years
 between the animals of the file name and
 
 collars being worn by other animals. The collar may have been worn by
 more than one different animal in the study period.
 
 So for example...
 
 filename: RD2
 
 And the data looks like:
 
 (I'm sorry here, dput(head(RD2, 200)) was outputting all the times,
 such that it was too large for the console, so I just used head() )
 
 head(RD2, 200)
 encounter_id   date encounter_start encounter_length
 1 15 22/06/201122:21:45   20
 2 10 04/07/201104:18:571
 3 10 04/07/201104:23:121
 4 15 08/07/201102:02:30   23
 5 15 08/07/201102:03:26  264
 6 15 08/07/201102:09:20   35
 7 15 08/07/201102:10:25  173
 8 15 08/07/201102:13:40   65
 9 15 08/07/201102:15:12   47
 1015 08/07/201102:17:16   65
 1115 08/07/201102:39:10   54
 1215 14/07/201102:20:271
 1315 14/07/201102:23:356
 1415 14/07/201102:25:521
 1515 14/07/201102:26:17   39
 1615 14/07/201102:28:36   31
 1760 14/07/201102:41:561
 1860 14/07/201102:42:301
 1960 14/07/201102:43:30   36
 2060 14/07/201102:45:381
 2160 14/07/201102:46:07   15
 2260 14/07/201102:46:59   11
 2352 14/07/201102:57:43   97
 2412 09/08/201122:13:421
 2541 18/08/201102:53:181
 2641 19/08/201100:57:461
 2741 19/08/201101:59:171
 2841 19/08/201102:06:16   21
 2941 19/08/201102:08:501
 3041 19/08/201102:09:26   29
 3150 19/08/201102:19:311
 3250 19/08/201102:20:201
 3350 19/08/201102:20:541
 3450 19/08/201102:21:25   25
 3550 19/08/201102:22:17   20
 3650 19/08/201102:23:00   10
 3750 19/08/201102:25:101
 3850 19/08/201102:25:541
 3950 19/08/201102:26:50   75
 4050 19/08/201102:29:531
 4150 19/08/201102:30:416
 4250 28/08/201119:32:471
 4350 28/08/201119:36:38   10
 4439 30/08/201122:13:141
 4552 13/09/201120:04:57   17
 4620 18/09/201100:32:438
 4717 02/10/201109:10:18   52
 4817 02/10/201109:15:491
 4917 02/10/201109:17:191
 5025 03/10/201117:16:206
 5141 05/10/201104:04:351
 5252 07/10/201122:59:57   45
 5362 16/10/201118:33:036
 5452 28/10/201115:19:47