[R] question about aggregate
R. Michael Weylandt
michael.weylandt at gmail.com
Sat Oct 22 15:18:24 CEST 2011
Perhaps I misunderstand your request, but isn't this just:
sum( (sci[,,2]==0L) & (sci[,1] =="L"))
with the usual floating point caveats.
Michael
On Sat, Oct 22, 2011 at 8:19 AM, Adel ESSAFI <adelessafi at gmail.com> wrote:
> Hi,
> It is not what I want, but, thx anyway.
> Regards
>
>
> 2011/10/22 Weidong Gu <anopheles123 at gmail.com>
>
>> 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.
>> >
>> >
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> 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
>
> [[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