It works.
Thank you so much.
Abou
==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300
Tel: (207) 228-8389
Fax: (207) 780-5607
E
I guess you are looking for the number of rows satisfying the following
condition.
Assuming that you have a cutoff k = 1, 2, 5, 10, 15
1) x[i,1] < k regardless of the value of x[i,2], OR
2) x[i,1] == k and x[i,2] == 1
Here is my take on this problem. It is not elegant but it seems to do the
job.
AIL PROTECTED] On
Behalf Of AbouEl-Makarim Aboueissa
Sent: Monday, March 03, 2008 11:55 AM
To: Henrique Dallazuanna
Cc: r-help@r-project.org; S Ellison
Subject: Re: [R] Help needed in R
Dear ALL:
Please see below. I hope this will make it more clear.
[1,]11
[2,]11 num
day, March 03, 2008 11:55 AM
To: Henrique Dallazuanna
Cc: r-help@r-project.org; S Ellison
Subject: Re: [R] Help needed in R
Dear ALL:
Please see below. I hope this will make it more clear.
[1,]11
[2,]11 number of all observations less than 1 with
indicator 1 (including th
Dear ALL:
Please see below. I hope this will make it more clear.
[1,]11
[2,]11 number of all observations less than 1 with
indicator 1 (including those 1 with indicator 1 but not 1 with
indicator 0)=2
[3,]10
[4,]10
[5,]10
[6,]10
[7,
For me is not very clear, but if I understand:
sapply(sort(unique(data[data[,2]==1,1])),
function(x)sum(data[data[,2]==1 & data[,1] <= x, 1]))
But the output is:
2 6 31 71 86
On 03/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote:
> Dear Ellison:
>
> it did not do i
Dear Ellison:
it did not do it.
I edited my previous email to make my question more clear.
The out put should be: (2,11,33,43,46)
For example:
number of all observations less than 1 with indicator 1 (including those 1 with
indicator 1 but not 1 with indicator 0) =2
num
Try this:
data <- as.data.frame(data)
names(data) <- c('Data', 'Indicator')
a)
sort(unique(subset(data, Indicator == 1))[,1])
b) with(subset(data, Indicator == 1),
tapply(Indicator, Data, sum))
On 01/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote:
> Dear ALL:
>
> I
At 23:07 01.03.2008, AbouEl-Makarim Aboueissa wrote:
>Dear ALL:
>
>I have two quick questions about how to perform some steps in R.
>Could you please see the attached MS file if the data not clean
>enough in this email.
>
>Thank you so much for all your helps.
>
>
>Abou
>
>
>
>Here it is:
>==
9 matches
Mail list logo