Re: [R] summing values according to a factor

2007-05-07 Thread Salvatore Enrico Indiogine
Dear Andy and all others who have replied:


On 07/05/07, Liaw, Andy <[EMAIL PROTECTED]> wrote:
> I guess what you want to do is compare Q1/T1 among the sections?  If you
> want to compute the sum of Q1/T1 by Section, you can do something like:
>
> sum.by.section <- with(mydata, tapply(Q1/T1, section, sum))
>
> Substitute sum with anything you want to compute.

That worked perfectly.   Thanks!

Enrico


-- 
Enrico Indiogine

Mathematics Education
Texas A&M University
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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] summing values according to a factor

2007-05-07 Thread Liaw, Andy
Howdy!

I guess what you want to do is compare Q1/T1 among the sections?  If you
want to compute the sum of Q1/T1 by Section, you can do something like:

sum.by.section <- with(mydata, tapply(Q1/T1, section, sum))

Substitute sum with anything you want to compute.

Cheers,
Andy

From: Salvatore Enrico Indiogine
> 
> Greetings!
> 
> I have exam scores of students in several sections.  The data 
> looks like:
> 
> StuNum Section Q1  T1
> 111   502 45   123
> 112   502 23123
> 113   503 58123
> 114   504  63   123
> 115   504  83   123
> ..
> 
> where Q1 is the score for question 1 and T1 is  the maximum possible
> score for question 1
> 
> I need to check whether the section has an effect on the scores.  I
> thought about using chisq.test and calculate the sums of scores per
> section.
> 
> I think that I have to use apply() but I am lost here.
> 
> Thanks in advance,
> Enrico
> 
> -- 
> Enrico Indiogine
> 
> Mathematics Education
> Texas A&M University
> [EMAIL PROTECTED]
> 
> __
> R-help@stat.math.ethz.ch 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.
> 
> 
> 


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

__
R-help@stat.math.ethz.ch 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.