Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Chris Beeley
Many thanks to you both. I have now filed away for future reference the 2 factor tapply as well as the extremely useful looking plyr library. And the code worked beautifully :-) On 24 Aug 2010, at 19:47, "Abhijit Dasgupta, PhD" wrote: > The paste-y argument is my usual trick in these situat

Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Abhijit Dasgupta, PhD
The paste-y argument is my usual trick in these situations. I forget that tapply can take multiple ordering arguments :) Abhijit On 08/24/2010 02:17 PM, David Winsemius wrote: On Aug 24, 2010, at 1:59 PM, Abhijit Dasgupta, PhD wrote: The only problem with this is that Chris's unique individu

Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread David Winsemius
On Aug 24, 2010, at 1:59 PM, Abhijit Dasgupta, PhD wrote: The only problem with this is that Chris's unique individuals are a combination of Type and ID, as I understand it. So Type=A, ID=1 is a different individual from Type=B,ID=1. So we need to create a unique identifier per person, sim

Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Abhijit Dasgupta, PhD
The only problem with this is that Chris's unique individuals are a combination of Type and ID, as I understand it. So Type=A, ID=1 is a different individual from Type=B,ID=1. So we need to create a unique identifier per person, simplistically by uniqueID=paste(Type, ID, sep=''). Then, using th

Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Abhijit Dasgupta, PhD
An answer to 1) > x = data.frame(Type=c('A','A','B','B'), ID=c(1,1,3,1), Date = c('16/09/2010','23/09/2010','18/8/2010','13/5/2010'), Value=c(8,9,7,6)) > x Type ID Date Value 1A 1 16/09/2010 8 2A 1 23/09/2010 9 3B 3 18/8/2010 7 4B 1 13/5/2010 6 > x$

Re: [R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread David Winsemius
On Aug 24, 2010, at 1:19 PM, Chris Beeley wrote: Hello- A basic question which has nonetheless floored me entirely. I have a dataset which looks like this: Type ID DateValue A 116/09/2020 8 A 1 23/09/2010 9 B 3 18/8/20107 B

[R] How to remove rows based on frequency of factor and then difference date scores

2010-08-24 Thread Chris Beeley
Hello- A basic question which has nonetheless floored me entirely. I have a dataset which looks like this: Type ID DateValue A 116/09/2020 8 A 1 23/09/2010 9 B 3 18/8/20107 B 1 13/5/20106 There are two Types, whi