Re: [R] grouping data together

2008-11-09 Thread jim holtman
If your grouping is a list, then you can use 'sapply'; e.g.,

sapply(yourRanking, function(x) sum(x$rank))  # or whatever you want the sum of.

On Sun, Nov 9, 2008 at 4:00 PM, Swanton0822 <[EMAIL PROTECTED]> wrote:
>
> Hi,
> i have group all the data, but now if i would want to sum all the rank in
> each group, how can i do it?
> ie. i want to sum the rank in every group, not total. so there will be a sum
> of rank for month Jan,Feb,.Dec, therefore there will be total of 12
> vaule of ranking sum.
> many thanks,
> --
> View this message in context: 
> http://www.nabble.com/grouping-data-together-tp20389726p20410781.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@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.


Re: [R] grouping data together

2008-11-09 Thread Swanton0822

Hi,
i have group all the data, but now if i would want to sum all the rank in
each group, how can i do it?
ie. i want to sum the rank in every group, not total. so there will be a sum
of rank for month Jan,Feb,.Dec, therefore there will be total of 12
vaule of ranking sum.
many thanks,
-- 
View this message in context: 
http://www.nabble.com/grouping-data-together-tp20389726p20410781.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] grouping data together

2008-11-08 Thread John Kane
A very simple but long way to do this would be to subset your data set.  There 
are better ways but this way would be easy to understand. 
January <- subset(mydata, Month=="January")

Repeat for each month.

--- On Fri, 11/7/08, Swanton0822 <[EMAIL PROTECTED]> wrote:

> From: Swanton0822 <[EMAIL PROTECTED]>
> Subject: [R]  grouping data together
> To: r-help@r-project.org
> Received: Friday, November 7, 2008, 6:03 PM
> Hi.
> i have a data, and there is 3 columns, Month, Year and
> Total. and there is
> over 1000 rows for them because there is 87 years data for
> every month, so
> there is month from Jan-Dec, and year from 1900-1987,
> so i was wondering if i would want to make 12 groups
> (Jan,Feb...,Dec),
> and put each year's total into the corresponding month
> (so every month group
> will have 88 values of total)
> how can i do that?
> many thanks.
> -- 
> View this message in context:
> http://www.nabble.com/grouping-data-together-tp20389726p20389726.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@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.


  __
[[elided Yahoo spam]]

__
R-help@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.


Re: [R] grouping data together

2008-11-08 Thread Swanton0822

. http://www.nabble.com/file/p20392420/kew.dat kew.dat 

Hi,
i did something wrong,
with the data attach all i want is 12 groups for the months like this:(group
1=group Jan,..group12= group Dec)
group 1 group 2 group 3.. group 12

and inside each group is the vaule of the rainfall of different year for
that month so it will be like this:
group 1 group 2 group 3.. group 12
1990 data
1991
1992
..
1987

so there is 88 rows  value for each column, and there will be 12 columns
and i want to rank them all together.
looks like the one below in example 2
http://www.stat.ufl.edu/~hhooker/KruskalEx1.pdf


and then all i want is the sum of rank of each group.
can anyone help me?
many thanks
-- 
View this message in context: 
http://www.nabble.com/grouping-data-together-tp20389726p20392420.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] grouping data together

2008-11-07 Thread jim holtman
If you provide the input and the expected output, it would help a lot.
 You could use 'split' to partition the data

monthly <- split(yourDF, yourDF$month)

but I am still not sure exactly what you want to do with it, or the
format that you are expecting.

On Fri, Nov 7, 2008 at 6:03 PM, Swanton0822 <[EMAIL PROTECTED]> wrote:
>
> Hi.
> i have a data, and there is 3 columns, Month, Year and Total. and there is
> over 1000 rows for them because there is 87 years data for every month, so
> there is month from Jan-Dec, and year from 1900-1987,
> so i was wondering if i would want to make 12 groups (Jan,Feb...,Dec),
> and put each year's total into the corresponding month (so every month group
> will have 88 values of total)
> how can i do that?
> many thanks.
> --
> View this message in context: 
> http://www.nabble.com/grouping-data-together-tp20389726p20389726.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@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.


Re: [R] grouping data together

2008-11-07 Thread cruz
hi friend,

this is from your previous posts on Kruskal-Wallis test:)
i came up with this one:

A5 <- read.table('kew.dat' ,header=TRUE)
plot(factor(A5$Month, levels=month.abb), A5$Rain)

is that what you want?


On Sat, Nov 8, 2008 at 7:03 AM, Swanton0822 <[EMAIL PROTECTED]> wrote:
>
> Hi.
> i have a data, and there is 3 columns, Month, Year and Total. and there is
> over 1000 rows for them because there is 87 years data for every month, so
> there is month from Jan-Dec, and year from 1900-1987,
> so i was wondering if i would want to make 12 groups (Jan,Feb...,Dec),
> and put each year's total into the corresponding month (so every month group
> will have 88 values of total)
> how can i do that?
> many thanks.

__
R-help@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] grouping data together

2008-11-07 Thread Swanton0822

Hi.
i have a data, and there is 3 columns, Month, Year and Total. and there is
over 1000 rows for them because there is 87 years data for every month, so
there is month from Jan-Dec, and year from 1900-1987,
so i was wondering if i would want to make 12 groups (Jan,Feb...,Dec),
and put each year's total into the corresponding month (so every month group
will have 88 values of total)
how can i do that?
many thanks.
-- 
View this message in context: 
http://www.nabble.com/grouping-data-together-tp20389726p20389726.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.