[R] Odp: Apply function

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Tue, 11 Nov 2008 11:10:28 +0100

Hi

r-help-bounces_at_r-project.org napsal dne 11.11.2008 06:59:55:

>
> Hi all
>
> I am manipulating a datafram which has 3 variables.Such as:
>
> 1 2 3
> 4 5 6
> .
> .
> .
> 200 210 300
>
> I also has a row index: index=c(100,200,250..300)
> I want to find the sums of first 100 rows, then the sum from row 101 to
row
> 200, then row 201 to row 250... the each end row is indicated by the
index.

A little bit vague question, hence vague answer.

make a factor which has 3 values repeated 100 times (rep) and then use almost any of aggregation function ( e.g. tapply, by, aggregate) with sum function.

Regards
Petr

>
> Can I use the apply function to do that? or any other way?
>
> Thanks
>
> Ted
>
>
> --
> View this message in context: http://www.nabble.com/Apply-function-
> tp20434042p20434042.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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. Received on Tue 11 Nov 2008 - 10:14:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Nov 2008 - 11:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive