Re: [R] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
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

Re: [R] Help needed in R

2008-03-03 Thread T.K.
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.

Re: [R] Help needed in R

2008-03-03 Thread Charles Annis, P.E.
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

Re: [R] Help needed in R

2008-03-03 Thread Charles Annis, P.E.
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

Re: [R] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
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,

Re: [R] Help needed in R

2008-03-03 Thread Henrique Dallazuanna
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

Re: [R] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
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

[R] Help needed in R

2008-03-03 Thread AbouEl-Makarim Aboueissa
Dear ALL: How I can find the number of observations less than each value in column one with indicator 1 in column two. Please see the data below. For example: number of observations less than 1 with indicator 1 (including those 1 with indicator 1) =2 number of observations

Re: [R] Help needed in R

2008-03-01 Thread Henrique Dallazuanna
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

Re: [R] Help needed in R

2008-03-01 Thread Heinz Tuechler
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: >==

[R] Help needed in R

2008-03-01 Thread AbouEl-Makarim Aboueissa
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: = Consider the following matrix: data<-matrix(c(2