[R] question about aggregate

Weidong Gu anopheles123 at gmail.com
Sat Oct 22 14:06:38 CEST 2011


try this

table(sci[,2]=0,sci[,1]=L)

Weidong Gu

On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI <adel.safi at imag.fr> wrote:
> Hello,
> is there any help please.
> Regards
>
>
> 2011/10/21 Adel ESSAFI <adelessafi at gmail.com>
>
>> Hello
>> I am discovering R and I find it is really very powerful.
>>
>> However, I find some newbie difficulties.
>>
>> Here, I have a data frame with manu values that I want to calculate the
>> frequency (the nomber of line) of the some criteria.
>> For exemple here,  I want it to print the number of occurence where
>> sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of the
>> line in the result data frame.
>> however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
>> Thank you in advance for any input.
>>
>>
>> >  aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
>>    Group.1 Group.2 x
>> 1      0.0       L 1
>> 2      0.2       L 1
>>
>>
>> --
>> PhD candidate in Computer Science
>> Address
>> 3 avenue lamine, cité ezzahra, Sousse 4000
>> Tunisia
>> tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
>> fax: +216 71 391 166
>>
>
>
>
> --
> *PhD candidate in Computer Science
> Address
> 3 avenue lamine, cité ezzahra, Sousse 4000
> Tunisia
> tel: +216 97 246 706
> fax: +216 71 391 166*
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



More information about the R-help mailing list